Python Forum
Run one Python Script from Another Script - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Run one Python Script from Another Script (/thread-33538.html)



Run one Python Script from Another Script - stylingpat - May-03-2021

Hello, if I do import "scriptname" I can load one python script from another. I am trying to make a main script that launches 5 seperate python programs at the same time.. but in different shells.. or windows.. Any way I can do that? Any way to do an import "scriptname" (into its own shell/window?)


RE: Run one Python Script from Another Script - Marbelous - May-03-2021

Yes, there are several ways. It depends on what your scripts are doing. You could always look into threading, sub-processes, multiprocessing, etc.

But, if you want an easy way to just run multiple scripts from one main script take a look at the tricks used here:
https://stackoverflow.com/questions/49105826/how-to-run-multiple-python-scripts-from-shell-one-after-another
https://stackoverflow.com/questions/53865580/run-multiple-python-file-concurrently