I am trying to use a python subprocess to execute a script, which interests me to be able to do an import of my project. When running in another process, I only have the typical modules, and not those of my project when doing an import. How can I get my modules imported?
Example:
first_script.py
import subprocess
from my_project.any_module import any_module
def __init__(self):
subprocess.call(['python', 'path/to/exec/second_script.py'])
second_script.py
from my_project.any_module import any_module
def __init__(self):
print any_module.argument
In the first script, import any_module works, in the second it does not.
Any ideas? Thx.