In simple terms, a module is a file consisting of Python or PowerShell code that has functions, classes, and variable definitions inside it.

Modular programming

A module can also be a logical organization of our code. The process of breaking large and complex programming tasks into small, manageable subtasks or modules is called modular programming. These small subtasks can be coupled together to form the building blocks of a complex but neat programming system.

Modular programming has several advantages, including simplicity, reusability, and maintainability in large programs.

Importing modules

Let’s start by importing a single module.

Importing single module

PowerShell provides an Import-module cmdlet to import modules into the current session.

## syntax: Import-Module <name of module>
Import-Module PSReadLine

Type the above command in the terminal below to see it in action.

Get hands-on with 1200+ tech skills courses.