Contribute Media
A thank you to everyone who makes this possible: Read More

Importing a module runs code


When Python imports a module, it runs all the code in that module. So if your Python file is meant to be imported as a module, be careful not to put side effects at the top-level of your .py file.


Improve this page