Creating Modules

We will learn how to create modules in Python and Powershell.

Writing or creating a module is just like creating any other program file in Python or PowerShell.

Creating a module in Python

To create a module in Python, let’s take the following sample function to print some text and save it in a file named hello.py.

### function definition
def world():
    print("Hello World! from Python")

Now we can directly import this module to our Python file as well as call functions and properties defined in the module file.

Get hands-on with 1400+ tech skills courses.