10

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

Reza Ramezanpour
  • 585
  • 8
  • 28
  • 1
    Please look into this [resource](https://realpython.com/python-modules-packages/). – de_classified Sep 15 '20 at 16:25
  • Does this answer your question? [What's the difference between a Python module and a Python package?](https://stackoverflow.com/questions/7948494/whats-the-difference-between-a-python-module-and-a-python-package) – Random Davis Sep 15 '20 at 16:37

1 Answers1

17
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.

Karan Raj
  • 344
  • 2
  • 8