Pycharm auto relative imports

前端 未结 3 1461
星月不相逢
星月不相逢 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条回答
  •  南笙
    南笙 (楼主)
    2021-01-07 20:50

    It appears currently there is no way to change the import style for auto-import feature to use relative imports. The only style changes you can make to import statements are how the absolute imports are structured:

    (The Jetbrains/PyCharm settings search functionality is excellent by the way).

    The same thing happens when refactoring, it's definitely an option I'd like to see added.

提交回复
热议问题