Java, .NET, PHP, PYTHON, ANGULAR, ML, Data Science, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

Module in Python

module is the collection of function in python , all predefined function of python has been declared using module. it is used to logically distribute the functions into separate file.

module will be automatically created in python using filename.

for example ,if we are creating a.py file name which contains four different methods then "a" will be module.

if we want to access the method of a.py into b.py then first we will import module then call function using
import modulename  (filename)
modulename.functionname()

a.py
.................
def fun1():
    print("fun1")

def fun2():
   print("fun2")


......................................

b.py
import a    #import is the keyword to access file as a module
a.fun1()


Post a Comment

POST Answer of Questions and ASK to Doubt

Previous Post Next Post