How can I create imports that always work?

前端 未结 4 1120
孤独总比滥情好
孤独总比滥情好 2021-01-27 23:08

I am struggling a bit to set up a working structure in one of my projects. The problem is, that I have main package and a subpackage in a structure like this (I left out all unn

4条回答
  •  终归单人心
    2021-01-27 23:26

    Use:

    from . import utils
    

    as suggested by Peter

    In your code.py you should use:

    from mypackage import work
    

提交回复
热议问题