PyCharm automatically adding absolute imports instead of relative
Let's say I write a name of a class that I haven't imported yet in the module that I write. PyCharm will automatically suggest importing that class and if I click or press the right keyboard shortcut, PyCharm automatically adds an import for that class which is cool.
The problem is that it always adds an absolute import (without “.”), when I need relative imports. And I always have to manually correct that.
From what I remember, there was a time when it was adding relative imports, but something has switched in my project and now the automatically added imports are absolute.
Can I change it so that it adds relative imports instead of absolute?
Please sign in to leave a comment.
Please try upgrading IDE to the latest version, disabling all non-bundled plugins (**Settings | Plugins**, click the cog icon -> Disable All Downloaded Plugins) and check if the problem persists.
If the problem remains unresolved, we would like to investigate it properly. Please create an issue on YouTrack (https://youtrack.jetbrains.com/newIssue) regarding this problem. Attach relevant logs (Help | Collect Logs and Diagnostic Data), screenshots, precise steps for reproducing the issue and a runnable code/project sample if needed.
For urgent inquiries, please use Help | Contact Support in the IDE.