I have two independent Python scripts that work independently by supplying relevant arguments. Now I need to call python1.py in python2.py and pass the relevant parameters that are accepted by python1.py.
Is this the right approach?
- Create a method
call_python1(args)insidepython2.py - Use subprocess module to execute
python1.py - Call
call_python1in the main method ofpython2.py
Note: Both scripts should keep working independently as they are now.
subprocessthe same way you execute any other shell command. So the general idea is right. Why is this even questionable?call_python1.pyfunction be implemented?