Learn
Practice
Newsletter
Resources
Resume
New
F
Toggle theme
0
F
Toggle theme
0
Toggle menu
Creating Modules
Last Updated: May 22, 2026
Medium Priority
13 min read
Get Premium
Subscribe to unlock full access to all premium content
Subscribe Now
Reading Progress
0%
On this page
What Makes a .py File a Module
Module-Level Code Runs on First Import
if __name__ == "__main__": for Dual-Use Files
Module Attributes
Documenting Modules
Where Python Looks for Modules: sys.path
Installing Your Module Locally: Editable Installs...
Module Size and Cohesion
Putting It Together: A Reusable Pricing Module...
See What's New
Aa
Notes
Star
Complete
Ask AI
from...import
Notes
Star
Complete
Ask AI
Packages