I have this structure
proj
utils.py
|- sub1
file1.py
|- sub2
file2.py
...
utils.py
is a module containing a bunch of useful functions. I want them to be accessible in every filesX.py
in the subdirectories, e.g. via utils.func1()
...
Therefor I want to import utils
from file1.py
via from .. import utils
, but I get a
ValueError: attempted relative import beyond top-level package
error.
Is there a clean way to do so without adding absolute paths and without editing the PYTHONPATH?