Calling an Imported Object
So that’s basically the filename of the other file, only without the
.py extension. And that’s an important detail because the name you use to import the module
adder is the same as the module’s filename
adder.py. For this reason, module filenames must be valid Python identifiers.
Add one blank line after the
import statement and leave the rest of your code unchanged. When you import one module into another, the contents of the imported module become available in the other.
The term calling module comes from the fact that you’re calling the imported function in this module. You’ve defined the function in
adder.py, but you’re calling it in
main.py, which makes
main.py the calling module.
Become a Member to join the conversation.