Welcome To
Modules

Modules In Python

The Modules in a python is just a saved file as python file . It contain the python code as lot of classes , functions, variables and other. why we are using this this module means it is a just a file of python code . but we can't put 1000 lines of code inside the same file that's why we are dividing the python code and later using that into external file. the python file extension .py or .pyc syntax for file Extension filename I mean module name . py extension

In for example you can create a module with name module.py after saving this file you create other file like module_Example.py . that module.py file here import that file inside the python code by using the import keyword that example shown in the below. please follow it

Creating Module

File name module.py

def greet(name,age):
       print(f"Hello{name}your {age} Years old!")

Importing The module

file name module_Example.py

import module
print(module.greet("darshan",19))

OutPut

Hello darshan your 19 years old!