I have a file:
STARTDIR/module/submodule/config.py
I have another file:
STARDIR/utils/filesys/getAbsPath.py
Why does this line work, in config.py
?
from ..utils.filesys import getAbsPath
It seems like ..
refers to module
, not STARTDIR
. There is no utils
in module
at all. In fact, doing
from .. import utils
yields
ImportError: cannot import name utils
This should work:
This is because:
from . import …
imports fromSTARTDIR/module/submodule/
from .. import …
imports fromSTARTDIR/module/
from ... import …
imports fromSTARTDIR/