0

How to start multiple Python scripts from one Python script ? I need on restart to start couple scripts ( server.py => Tornado, backup.py => scheduler to dump database, watcher => monitoring system). All those I was starting manually one by one, how to start all of them in separated processes through one new script ( like python all.py)

Damir
  • 54,277
  • 94
  • 246
  • 365
  • Have a look at [subprocess](http://docs.python.org/3.3/library/subprocess.html) which can help you in starting any file you want. But if you want them to be in a single python process: Import the scripts and execute them in a new thread. I hope you have `if __name__ == '__main__':` statements in your scripts. – javex Aug 20 '13 at 12:27

1 Answers1

1
p = subprocess.Popen(command, shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)

For more informations read this