Skip to content
Advertisement

python run multiple scripts

Hi i would like to run add1.py and add2.py simultaneously and have searched BAT file and SH file but couldnt do it myself. Anyone can help me? The folder is in the following path C:UsersJiaDownloadsTelegram BotScripts I might also add more scripts like add3.py add4.py and the list goes on. Does anyone have simple tips that can help me run every script in this folder? Thank you!

It would be even better if the script runs one after another, example add2.py runs after add1.py finishes.

enter image description here

Advertisement

Answer

As someone else already suggested, you could make a python file which executes your N python scripts.

Using subprocess as described here: https://stackoverflow.com/a/11230471/11962413

import subprocess

subprocess.call("./test1.py", shell=True)
subprocess.call("./test2.py", shell=True)
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement