Courses / Python
38. Using __init__.py
Learn the purpose of the __init__.py file in a Python package.
1 min read Chapter 38 of 72
Python
Using __init__.py
`__init__.py` is a special file that indicates a directory is a Python package.
"I want to organize my code into packages, but how do I make Python recognize them?"
The `__init__.py` file is used to mark a directory as a Python package and can also execute initialization code for the package.
"I want to organize my code into packages, but how do I make Python recognize them?"
The `__init__.py` file is used to mark a directory as a Python package and can also execute initialization code for the package.