I have searched and tried a lot of codes for that topic. I am trying to run two python files but to run both at the same time This is my try
import subprocess subprocess.run("py pop1.py & py pop2.py", shell=True) But this executes the first python then the second one. This is not the target. My target is to run both files at the same time.
&puts the thing on the left into a background task, so the two actually do run simultaneously. But mileage may vary on other shellspycommand, I'm guessing you are on Windows. The Windows command line does not support starting multiple commands at once. They'll run serially. You can simulate that by using multiple calls tosubprocess.