I'm trying to organize my python files to keep everything neat and I'm trying to figure out how best to call one file from one module by another file in another module. I've seen various path explanations, but I don't really understand their explanations. This is what my file structure looks like:
Source
│ Main.py
│
├───utils
│ listOfAllNames.py
│
└───helpers
printer.py
In Main.py I call printer.py as a subprocess and printer.py imports listOfNames.py so that it can access the names it needs to print. I do this by saying: from utils import listOfAllNames
If I call printer.main() in Main.py then it works as intended because Main.py's location has a folder called 'utils' to pull from, but when I call it as a subprocess, printer.py has no utils in its folder to work with. I've tried importing like this: from ..utils import listOfAllNames, but then I get the error: ImportError: attempted relative import with no known parent package.
I don't know how to make printer.py realize that there is indeed a parent.
I know the easy way is to have everything in the same folder, but I want things to be organized, as there will be a lot of files going into this.
printer.py's__name__is"__main__"and has no parent.p = subprocess.Popen(["python", "helpers/printer.py"])