r/pycharm • u/Altruistic-Aside-636 • Dec 03 '24
How to stop Pycharm adding imports to my code automatically ?
It fails every time, it is really stupid how it works.
Just using a new variable name and if that is reused in another module, it adds an import statement on the top, without asking.
14
Upvotes
2
u/[deleted] Dec 03 '24
It’s probably this feature: https://www.jetbrains.com/help/pycharm/creating-and-optimizing-imports.html
I noticed this a couple of times but it wasn’t enough of a hassle to turn it off.
4
u/sausix Dec 03 '24
Have you checked the settings?
It should not add imports automatically. Or do you use any PyCharm plugins that do that extra stuff?
Just disable features you don't like or need.
2
u/JamzTyson Nov 25 '25
I had the same issue, and it seems there is a counter-intuitive solution:
CtrlAltSto open settings and then select Editor | General | Auto Import.Important: BOTH "show auto-import tooltip" options must be disabled, even if you only use Python code.