Modules are essentially similar to header files in C, but not exactly, and modules are similar to libraries, but not exactly. All Python files only look like scripts until they are "imported" by another Python program. Importing allows you to include a Python script and all the functions and variables it contains inside of another script or program. Code reuse is one of the primary reasons for having Modules.
Modules also create namespaces, which may or may not mean something do you. Suffice it to lssay that modules create there own scope, kind of like global and local scope, or local and function scope.
|