0
import time

time.time()
time.sleep()

So for example I imported time and using only 2 functions from this module. Is there a hotkey or plugin to import only this functions automaticly and pop module name every time I used some function from there, without manually chainging every line.

What I am trying to get is

from time import time,sleep

time()
sleep()
  • Does this answer your question? [How to import other Python files?](https://stackoverflow.com/questions/2349991/how-to-import-other-python-files) – bad_coder Jan 05 '21 at 20:59

1 Answers1

0

There are different configuration, depending on your needs I suggest you to go through this official JetBrains documentations about

Auto import.

To configure auto-import, in the Settings/Preferences dialog Ctrl+Alt+S , go to Editor | General | Auto Import, and use the corresponding XML, Python, and TypeScript/JavaScript options.

To enable / change the short cut, do the following:

  1. Go to PyCharm -> Preferences
  2. Check “Show Import Popup”
  3. Next, look up the keyboard shortcut for auto-completion and change it to whatever shortcut you’d like to use.

When you tap this shortcut twice you will get the special auto-import dropdown

Or also

You can define your preferred import style for Python code by using the following options available on the Auto Import page of the project settings (Settings/Preferences | Editor | General | Auto Import).

Federico Baù
  • 6,013
  • 5
  • 30
  • 38