Does bash keep the python instance open untill the script is done?

59 Views Asked by At

I have a bash-script

python task1.py && python task2.py

they are both pretty memory heavy and it seems liek the memory hangs after task1.py is done i.e it keeps rising. It is scheduled to run via. windows task manager if that has any influence.

Does windows create two python instances (one after the other is finished) and closes them when the script is done, or is it more like "open-close-open-close" ?

2

There are 2 best solutions below

2
On BEST ANSWER

The Bash concatenation, launch the second command after the first one return, so the logic is "open-close open-close".

When you task.py ends the python interpreter is closed and then reopened to execute the task2.py.

2
On

Your script doesn't affect the way the instances of Python are created internally.

These commands are run one after another, also only when python task1.py exits without errors.