Modules & Packages
imports, packages, and if __name__ == "__main__"
30 min · interactive lesson with runnable code and 3 graded exercises.
What you'll be able to do
- Explain what happens when Python imports a module
- Use if __name__ == "__main__" correctly
- Organize a package with __init__.py and relative imports
- Avoid import-time side effects, circular imports, and shadowing
The full lesson is free with an account.