Currently if i do Alt+Enter on a function in a different module which isn't imported yet it simply adds it to a an existing import line.
Say I have:
from my_package.my_module import do_something
my_module.do_something()
Then I type:
from my_package.my_module import do_something
do_something()
do_something_else() # My new line
I love that I can simply Alt+Enter on do_something_else
and it gets imported. But what happens is this:
from my_package.my_module import do_something, do_something_else
do_something()
do_something_else()
While what I would like to happen is this:
from my_package.my_module import do_something
from my_package.my_module import do_something_else
do_something()
do_something_else()
I looked into the settings, but none of the ones I saw seemed right.
These are the ones I've looked at for now:
Where else can I look? Seems like something which should be possible. Maybe one of the options above is the one I'm looking for, but just didn't understand was the right one?
This can now be done easily:
Settings > Code Style > Python > Imports
Then under Structure of "from" imports
check the Always split imports
option.
Currently there does not seem to be a way to do this, but there is an open ticket that you can up vote if you would like to have this feature.
https://youtrack.jetbrains.com/issue/PY-20100
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With