Python : Programming Language

Module

Modules in Python is a normal python source file which can store function, variable, classes, constants etc. Module helps us to break a large source files and organize related codes for easy understanding and better readability. For e.g we can create math module in which could have all mathematical related functions, classes, constants etc.

Module Creation:

Create any file and name it with an extension of py. Though file name or extension in Python does not have any specification like .c for C program or .java for java program, but we use .py just as a general convention.

Use Module

import module_name
module_name is name of module source file without extension.

Selective use of module

If we do not want to use everything from a module but some selected function or class then we can do using from-import keyword pair some like:
from mymodule import function