how to run multiple files of python simultaneously
I have three files pop.py pop1.py pop2.py i want to run this file concurrently this files are getting run one by one python code to run all files
You can easily accomplish this with the subprocess module.
import subprocess
process1 = subprocess.Popen(["python", "pop.py"]) # Create and launch process pop.py using python interpreter
process2 = subprocess.Popen(["python", "pop1.py"])
process3 = subprocess.Popen(["python", "pop2.py"])
process1.wait() # Wait for process1 to finish (basically wait for script to finish)
process2.wait()
process3.wait()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With