less than 1 minute read

It is a container where you can save one o more relevant modules to organize. To create a package, you create a new folder and place the relevant modules in that folder, you need to add a __init__.py file in the folder otherwise python will not recognize as a package.

Example:

Suppose that you need to develop a large application.The app will have many modules. When the number of modules grows, it’ll become difficult to keep all of them in one location. This is where packages come into play.

Python-Packages.png

Additional information

Module - It is a .py file containing Python statements and definitions.

__init__.py - It is essential for the folder to be recognized by Python as a package and usually it is empty.

References

Python packages

Module and Init