I have a piece of code that is in charge of spawning new independent processes (which should live after the main process terminates).
When I run this code using 'run' from PyCharm
they do get spawned independently and stay alive even after their parent terminates.
The problem is when running from a cmd shell (in windows), they get spawned but it seems as if they are bound to the spawning shell (Not the python script), so the main script finishes but the shell stays active and once I close it the processes gets terminated.
service_path = "some_service_path"
service_arguments = "some arguments"
python_execution_location = os.path.join(os.environ["PYTHON3_ROOT"], "python.exe")
execution_value = "{} {} {}".format(python_execution_location, service_path, service_arguments)
my_process = subprocess.Popen(execution_value, shell=True)