0

Will two python scripts stored in different files launched using subprocess.Popen get around the Global Interpreter Lock (GIL)?

For example: in "spam.py" there is:

def spam():
    # do things for some time...

and in "eggs.py" there is:

def eggs():
    # do things for some time...

both "spam.py" and "eggs.py" are launched in "both.py":

import subprocess

subprocess.Popen("python3 /path/to/spam.py", shell=True)
subprocess.Popen("python3 /path/to/eggs.py", shell=True)

Will spam.py & eggs.py run in separate processes?

Shookti
  • 23
  • 3
  • yes, but you are most likely aiming for the wrong module, if you are running python code you should be using the multiprocessing module, not the subprocess module. – Ahmed AEK Oct 24 '22 at 14:24

0 Answers0