I have a file structure like this:
a.py
b.py
c.py
scripts:
--script1.py
--script2.py
I want the scripts to be able to import files from the parent directory. What would be the best way to do this?
Ideally, I'd avoid using PYTHONPATH hacks.
I have a file structure like this:
a.py
b.py
c.py
scripts:
--script1.py
--script2.py
I want the scripts to be able to import files from the parent directory. What would be the best way to do this?
Ideally, I'd avoid using PYTHONPATH hacks.
I would use:
import sys
sys.path.insert(0, full/path/to/import/folder)
import a, b, c
My IDE does not detect the module and calls it an error, but when I run the code, it works. Hopefully, it works for you too! Also, try searching stuff up like this on google, this is one of the most popular ways.