How to run two py files
How can I first run a py file to open some files and then another py file to run a task. How to run 2 py files or more.
How can I first run a py file to open some files and then another py file to run a task. How to run 2 py files or more.
A python script can be executed by another python script with execfile. Use a main script to execute the two scripts. For example:
execfile('file1.py')
execfile('file2.py')
If the second py needs data from the first py (or wait to finish), then there is no saving in time. It is still a sequential process. It is the dynamic simulation itself that takes the most time in a dynamic study. Use a single file in a parallel process. Do post-processing separate.
Open separate CMD windows and run pythoni in windowi. The problem arises if both python scripts need to interact between them.
Another option is to use "subprocess" or "multiprocessing" (as a 'parent') to better control multiple tasks executed by different other scripts ('child' processes)