Search for a class in the project and import
Answered
Hello, I'm trying to get the suggestion working when I'm trying to use a function or a class that is not actually imported.
if I start typing something, the Auto Import show me the class/functions available in the current model, but what if I need to search, import and use something?
At the moment, what I do is:
- Navigate > Class
- Search for the class I need
- The navigate window show me the list while I'm typing and then I get what I need.
Then I have 2 choices:
- If I press enter, I go to the definition of the class and I don't want this
- If I copy (cmd+c) I get the path of the class I want to use but is not what I want to do
What I do, is to write the class I found in the code and then fire the Auto Import to add the import at the top of the module. Is there a way that the `code completion` could let me search the class, complete it in the code and also auto import?
Thank you.
Please sign in to leave a comment.
Hi,
Please see https://www.jetbrains.com/help/pycharm/auto-completing-code.html. So if you type, for example, `time` and hit ctrl+space space then you will be able to select the module and it will be automatically imported.
The quick-fix for errors and warnings is also available when hit alt+enter.
Thank you!