python - how to import py file from different upper folder? -
all,
file structure:
\ util utils.py modules __init__.py modules1.py submodule __init__.py submodule.py
i want know how import utils.py
in
__init__.py
for example, run python interpreter in \ level, run import modules
, suppose code from ..util.utils import *
may works, not.
may know mistake? , may know if there's way can import utils.py in universal format?
import \util\utils.py
i know may use path.append(), alternative?
thanks
============
got answer post:
if developping python package (what doing, have init.py), simple way import module via package. example, if package called mypackage
, then:
import mypackage.utils
Comments
Post a Comment