Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python module vs sub-module vs package vs sub-package

Tags:

python

module

In Python, What is the differences between module, sub-module, package and a sub-package?

like image 748
Reza Ramezanpour Avatar asked Jan 25 '26 08:01

Reza Ramezanpour


1 Answers

package
|-- __init__.py
|-- module.py
|-- sub_package
        |-- __init__.py
        |-- sub_module.py

Consider packages and sub-packages as folders and sub-folders containing init.py file with other python files.

modules are the python files inside the package.

sub-modules are the python files inside the sub-package.

like image 169
Karan Raj Avatar answered Jan 26 '26 21:01

Karan Raj