All,
File structure:
\
util
  utils.py
modules
  __init__.py
  modules1.py
  submodule
     __init__.py
     submodule.py
I want to know how to import utils.py in those 
__init__.py 
for example, now I run the python interpreter in \ level, I run import modules, I suppose the code from ..util.utils import * 开发者_C百科may works, but it is not.
may I know where is the mistake? and may I know if there's a way i can import utils.py in a universal format? something like
import \util\utils.py
I know I may use path.append(), but any alternative?
Thanks
============
got the answer from this post:
Import a module from a relative path
If you are developping a python package (what you are obviously doing, as you have init.py), then the most simple way to import your module is just via the package.
For example, if your package is called mypackage, then:
import mypackage.utils
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论