In this lesson, you’ll learn about Python packages. Suppose you have developed a very large application that includes many modules. As the number of modules grows, it becomes difficult to keep track of them all if they’re dumped in one location. This is particularly true if they have similar names or functionality. You might want a way to group and organize them.
Packages allow for a hierarchical structuring of the module namespace using dot notation. In the same way that modules help avoid collisions between global variable names, packages help avoid collisions between module names.
Creating a package is quite straightforward, since it makes use of the operating system’s inherent hierarchical file structure. Consider the following arrangement:

Here, there is a directory named pkg that contains two modules, mod1.py and mod2.py. Take a look at the contents of the modules. Here’s mod1.py:
def load_data():
print('loading data using mod1.load_data()')
class Customer:
pass
Here’s mod2.py:
Ricky White RP Team on July 5, 2020
Try adding a
__init__.pyfile to your pkg folder. There doesn’t have to be any code in it, but it’s presence will help it be identified as a package that can be imported.