python - Import submodule from another one -
python - Import submodule from another one -
i though easy, can't it. read in the doc should work :
filea/__init__.py
#nothing here
file a/b.py
var = "hello world"
file a/c.py
import b print(b.var)
from .
:
>>> import a.c importerror: no module named 'b'
but not… have forgotten ? because utilize python 3 ?
yes, it's because of python3.
in python 3, implicit relative imports within packages no longer available
changes in import statement python3
python module
Comments
Post a Comment