I've been working on some scripts that pull data from the web in JSON format and convert to CSV files. There are roughly 20 scripts and I'm looking for the best way to run them at once. Right now I just type python script1.py into Windows PowerShell and then repeat. Is there an easy way to go about this?
2 Answers
You could use separate processes to run scripts
it could be helpful to read subprocess module
import subprocess
for fileName in files:
subprocess.Popen(['./{}.py'.format(fileName)])
Comments
A way you could do this is by making another script that runs the different programs.
For example what you would do is:
exec(open("[where ever the file is located]").read())
Then you could have it run a certain amount of times in a for loop and take the file names out of an array!
Files = ['C:\\filename.py', 'C:\\filename2.py']
and so on.