Adding Objects to a Namespace
Before we wrap up this lesson, let me show you one more cool thing. Any new variables or functions that you add to
adder.py will be accessible in
main.py without you having to import anything new.
When you run the module, there is no error, and the values
8 are displayed in the interactive window. So since
double() already exists in the namespace, no
NameError is raised and you can use it right away. That’s pretty convenient.
Become a Member to join the conversation.