What is the difference between Python’s Module, Package and Library?

Module

A Module is a .py file that defines one or more functions and/or classes, which you intend to reuse. To reuse functions or classes of a given module you simply need to import the module.

Example: Save the following code in a file called test_module.py.

def myFunc():
    print("This is printed by my test module!")

Import your module named test_module and call myFunc function inside it.

import test_module

test_module.myFunc()

Output:

This is printed by my test module!