Introduction
In this lab, you will learn how to differentiate between modules and packages in Python, which is crucial for organizing and managing your code effectively. The lab guides you through creating a package named my_package
containing an __init__.py
file and a module named my_module.py
.
You will then create a main.py
script outside the package to import and use the module, illustrating the distinction between a module (a single file containing Python code) and a package (a directory hierarchy containing modules and an __init__.py
file). The lab sets the foundation for understanding how to check if a module is a package using the __path__
attribute and the pkgutil.get_loader
method, which will be covered in subsequent steps.