Difference between module and package?. addon how do you create package in python?

Last updated 3 weeks, 4 days ago | 19 views 75     5

Tags:- Python

Python | Module and Package

  • Module: The module is a simple Python file that contains collections of functions and global variables and with having a .py extension file. It is an executable file and to organize all the modules we have the concept called Package in Python.
  • Package: The package is a simple directory having collections of modules. This directory contains Python modules and also has a __init__.py file by which the interpreter interprets it as a Package. The package is simply a namespace. The package also contains sub-packages inside it.

To create a Python package of our own, we create a directory and create a file __init__.py in it. We leave it empty. Then, in that package, we create a module(s) with whatever code we want.