this is effectively importing the module in the same way that import fibo will dowith the only difference of it being available as fib it can also be used when utilising from with similar effectsfrom fibo import fib as fibonacci fibonacci( notefor efficiency reasonseach module is only imported once per interpreter session thereforeif you change your modulesyou must restart the interpreter orif it' just one module you want to test interactivelyuse importlib reload() import importlibimportlib reload(modulenameexecuting modules as scripts when you run python module with python fibo py the code in the module will be executedjust as if you imported itbut with the __name__ set to "__main__that means that by adding this code at the end of your moduleif __name__ ="__main__"import sys fib(int(sys argv[ ])you can make the file usable as script as well as an importable modulebecause the code that parses the command line only runs if the module is executed as the "mainfilepython fibo py if the module is importedthe code is not runimport fibo this is often used either to provide convenient user interface to moduleor for testing purposes (running the module as script executes test suitethe module search path when module named spam is importedthe interpreter first searches for built-in module with that name if not foundit then searches for file named spam py in list of directories given by the variable sys path sys path is initialized from these locationsthe directory containing the input script (or the current directory when no file is specifiedpythonpath ( list of directory nameswith the same syntax as the shell variable paththe installation-dependent default noteon file systems which support symlinksthe directory containing the input script is calculated after the symlink is followed in other words the directory containing the symlink is not added to the module more on modules