How do I import other files in Python?
- How exactly can I import a specific python file like import file.py?
- How can I import a folder instead of a specific file?
- I want to load a Python file dynamically at runtime, based on user input.
- I want to know how to load just one specific part from the file.
For example, in main.py I have:
from extra import *
Although this gives me all the definitions in extra.py, when maybe all I want is a single definition:
def gap():
print
print
What do I add to the import statement to just get gap from extra.py?