Modules

What is a module?

In Python, a module is a file that contains code. Modules are used to break up large programs into smaller parts for more manageable coding.

Why are modules important?

Modules divide up complex programs. Programmers break up larger projects into different files, each of which focuses on a single aspect of the project. This makes large projects easier to write and collaborate on in teams: each programmer can focus on only the module they're responsible for.

How do you use a module in a program?

To create a module, you move code with a particular aim into a separate file. To use a module, import it into the file you're working on to make the code available. You can import the entire module or only the needed parts.