I am relatively new to both Python and bash. However, I find Python much more comprehensible and understandable than bash. I have several bash scripts that I managed to build, but I would like to replace them with Python scripts - for ease of maintenance, etc.
Bash scripts basically run python scripts, check the returned status code and act accordingly (for example, register a message, start an email, etc.) - this is the functionality that I can mostly play, play back the Python script.
The only thing I don’t know how to do is to run a python script from another python script and get the returned status code.
Can someone post a snippet here that shows how to run a small python script 'test.py' from the main python script 'master.py' and correctly get the return code after running test.py from master.py?
source share