Since python supports code re usability, many people today love to learn python programming. One way to achieve code re usability is FUNCTION(). But with function, we can achieve code re usability for a certain line of code. But there may be a case, where we need to include code in terms of hundreds of lines. In such cases, this function does not work well(Increases the length of the code). So in this case, we will place this code in a separate file and we can use this file at the time of requirement. And this can be achieved through the concept of python modules.
A module is a python file containing Python definitions and statements. The file name should have an extension of .py. In python modules, we can group similar data. This makes the programmer to easily understand the code. And within the module, the module name is available the global variable __name__. This module contains the executable statements as well as the function definitions. Modules can import the other modules too. Usually, modules are imported as follows:
From – This is used to indicate the file names that should be imported from.