6. What is a Package?
A package is a folder that contains multiple related modules. Example structure:7. What is __init__.py?
__init__.py is a special file inside a package.
It tells Python that the directory should be treated as a package (especially in older Python versions) and can also run initialization code or expose selected functions.
Example:
utils.py
init.py
main.py
greet in __init__.py, you would write:
8. Importing Modules from a Package
Folder structure:calculator.py
main.py
6. What is a Package?
A package is a folder that contains multiple related modules. Example structure:7. What is __init__.py?
__init__.py is a special file inside a package.
It tells Python that the directory should be treated as a package (especially in older Python versions) and can also run initialization code or expose selected functions.
Example:
utils.py
init.py
main.py
greet in __init__.py, you would write: