python - Import submodule from another one -



python - Import submodule from another one -

i though easy, can't it. read in the doc should work :

file a/__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

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -