Python 2 user here.
I am attempting to do a relative import within python subprocesses (i.e. processes called with python subprocess package https://docs.python.org/2/library/subprocess.html), which naturally fails with an "Attempted relative import in non-package." This is happening because the python script is getting executed as a main, and hence relative imports fail. I was wondering if there was a way around this?
Here is the file structure:
PythonProgramDriver/
subprocess1/
/helpers1
/script1
subprocess2/
/helpers2
/script2
data/
script2 needs to call a function in helpers1. But it cannot import the function. I have tried 'from .subprocess1 import helpers1' but I get the "Attempted relative import.." error......
Any help on this? Thanks