How to use Loop to execute os.system in python

import os
import glob
import threading


class push:

    def start(self):
        self.main()

    def main(self):
        alllist = glob.glob("*")
        dirlist = filter(os.path.isdir, alllist)
        for path in dirlist:
            self.pull(path)
        threading.Timer(self.main, 10000)

    def pull(self, path):
        os.chdir(path)
        os.popen("git push")
        return


pushInstance = push()
pushInstance.start()
The result of

execution is that the loop ends in the first directory and I don"t get the result I want to execute the Push command in each directory. New to python

Update:

has found out the problem. Return to

manually after changing directories.
import os
import glob
import threading


class push:

    def start(self):
        self.main()

    def main(self):
        alllist = glob.glob("*")
        dirlist = filter(os.path.isdir, alllist)
        for path in dirlist:
            print(path)
            self.pull(path)
        threading.Timer(self.main, 10000)

    def pull(self, path):
        os.chdir(path)
        os.system("git push")
        os.chdir("..")


pushInstance = push()
pushInstance.start()

but I still don"t understand why the change to the working directory will cause the whole loop to break?

Sep.03,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e64b61-45aba.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e64b61-45aba.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?