import in python is similar to #include header_file in / +python modules can get access to code from another module by importing the file/function using import the import statement is the most common way of invoking the import machinerybut it is not the only way import module_namewhen the import is usedit searches for the module initially in the local scope by calling __import__(function the value returned by the function is then reflected in the output of the initial code exampleimport math print(math pioutput import module_name member_namein the above code modulemath is importedand its variables can be accessed by considering it to be class and pi as its object the value of pi is returned by __import__(pi as whole can be imported into our initial coderather than importing the whole module examplefrom math import pi note that in the above examplewe used math pi here we have used pi directly print(pioutput from module_name import in the above code modulemath is not importedrather just pi has been imported as variable all the functions and constants can be imported using