Python: Problem with local modules shadowing global modules

后端 未结 2 538
無奈伤痛
無奈伤痛 2020-12-30 05:41

I\'ve got a package set up like so:

packagename/
    __init__.py
    numbers.py
    tools.py
    ...other stuff

Now inside tools.py

2条回答
  •  北海茫月
    2020-12-30 05:58

    absolute and relative imports can be used since python2.5 (with __future__ import) and seem to be what you're looking for.

提交回复
热议问题