i have the following loop with a print and a subprocess call
for file in os.listdir(dir):
print(file)
subprocess.call(['python', 'otherscript.py', file])
otherscript.py prints some stuff as well. so when i execute my main script, everything that my main script should print before calling otherscript.py will be printed after otherscript.py is called for the last time:
- output from subprocess 1
- output from subprocess 2
- output from subprocess 3
- output from main 1
- output from main 2
- output from main 3
how can i make it print before calling the subprocess?