Skip to main content

4.1) Modules


Importing code written by others allows you to greatly expand the capabilities of Python. You do this by importing modules.

A module is essentially a collection of Python functions and objects that wouldn’t be available by default. Some modules are installed in the standard version of Python (built-in), while others have to be installed as part of a distribution (e.g. Canopy) or separately. We also call those modules libraries or packages. When you reach an advanced Python level, you might want to write your own modules.

The 'math module', for example, allows you to use mathematical functions such as logarithm, cosine and others.