Modules refer to a file containing Python statements and definitions.
If you want to save a code as module save it using .py extension. The Module consists of functions, classes, variables, constants, etc.
We can use the module by importing it in our program. Grouping related code into a module makes the code easier to understand and use.
The Module name is the same as the file name we have saved our code.
If we want to use a particular module we just have to write import with the module name or file name. After importing module we can use all the functions, classes, variable, etc. present in the module.
e.g., We will make a demo.py module.
def addition(a, b): return (a+b) def subtraction(a, b): return (a-b)
Now import the module demo.py in a program and use its function.
import demo print(addition(12, 4))
This is all about importing module in python.