There is a python script start_test.py
.
There is a second python script siple_test.py
.
# pseudo code:
start_test.py --calls--> subprocess(python.exe simple_test.py, args_simple_test[])
The python interpreter for both scripts is the same. So instead of opening a new instance, I want to run simple_test.py
directly from start_test.py
. I need to preserve the sys.args environment. A nice to have would be to actually enter following code section in simple_test.py
:
# file: simple_test.py
if __name__ == '__main__':
some_test_function()
Most important is, that the way should be a universal one, not depending on the content of the simple_test.py
.
This setup would provide two benefits:
- The call is much less resource intensive
- The whole stack of
simple_test.py
can be debugged with pycharm
So, how do I execute the call of a python script, from a python script, without starting a new subprocess?