11. Modules

Module in Python is a plain text file with Python code and .py extention. It allows logical ordering and grouping of the code. Division into modules can be done, for example, by this logic:

  • division of data, formatting and code logic
  • grouping functions and other objects by functionality

The good thing about modules is that they allow you to reuse already written code and not copy it (for example, do not copy a previously written function).