Pycharm auto relative imports

前端 未结 3 1479
星月不相逢
星月不相逢 2021-01-07 20:26

Whenever you use autoimport provided by PyCharm it generates an absolute path import. i.e.

from my_package.my_subpackage import my_thing

in

3条回答
  •  旧时难觅i
    2021-01-07 20:32

    It will be possible starting with 2019.3 https://youtrack.jetbrains.com/issue/PY-6054 Note, that it will not do the relative import automatically if there are no other relative imports in that file yet. There is also an action to convert the existing absolute import to relative:

提交回复
热议问题