Here is a very simple example of a Python module.
First, we create a file called mymodule.py containing a simple function called greet.
def greet(): print("Hello")
Now we can use this file in another Python program by ‘importing’ it. Then we can access the greet function via the name of the module (which is just the name of the file without the .py extension).
import mymodule mymodule.greet()
Using Aliases to Module Names
You can give imported modules an alias to make them easier to refer to.
import mymodule as mm mm.greet()