python 3.x - Error in import module in subpackage -
python 3.x - Error in import module in subpackage -
i having bundle structure:
root/package/__init__.py root/package/main.py root/package/subpackage/__init__.py root/package/subpackage/script1.py root/package/subpackage/script2.py
then in main.py have from package.subpackage import script1
in script1 have:
import script2 def do_smt(): script2.do_smt()
so when run main.py
invokes script1.do_smt()
, importerror
script1 @ line import script2
.
i have set pythonpath=..../root/
do miss out anything?
thanks
update: when tried above setup in python 2, works fine. python3 related error. running python 3.4
in python 3 can
from .script2 import * #1 package.subpackage.script2 import * #2 package.subpackage import script2 #3 . import script2 #4
relative imports seem required more specified.
python-3.x python-import
Comments
Post a Comment