I would like to create a simple Python program that will concurrently execute 2 independent scripts. For now, the two scripts just print a sequence of numbers but my intention is to use this program to concurrently run a few Twitter streaming programs in the future.
I suspect I need to use subprocess.Popen but I cannot quite get my head around what arguments I should put in there. There was a similar question on StackOverflow but the code provided there (pasted below) doesn't print anything. I will appreciate your help.
My files are:
thread1.py
thread2.py
import subprocess
subprocess.Popen(['screen', './thread1.py']))
subprocess.Popen(['screen', './thread2.py'])
./thread1.py;./thread2.pypython thread1.py;python thread2.py. In your case I assume you don't have the python preambula, so your scripts require to use python interpreter, as I stated above. That's the reason, why you second script didn't run. Pay attention you should be in the directory your files are located in, and you don't need the "./" prefix, that indicates you to take file from the present folder.