__future__ import even in code run by version of python where the feature is present normally mixed usage modes__name__ and __main__ our next module-related trick lets you both import file as module and run it as standalone programand is widely used in python files it' actually so simple that some miss the point at firsteach module has built-in attribute called __name__which python creates and assigns automatically as followsif the file is being run as top-level program file__name__ is set to the string "__main__when it starts if the file is being imported instead__name__ is set to the module' name as known by its clients the upshot is that module can test its own __name__ to determine whether it' being run or imported for examplesuppose we create the following module filenamed runme pyto export single function called testerdef tester()print("it' christmas in heaven "if __name__ ='__main__'tester(only when run not when imported this module defines function for clients to import and use as usualc:\codepython import runme runme tester(it' christmas in heaven but the module also includes code at the bottom that is set up to call the function automatically when this file is run as programc:\codepython runme py it' christmas in heaven in effecta module' __name__ variable serves as usage mode flagallowing its code to be leveraged as both an importable library and top-level script though simpleyou'll see this hook used in the majority of the python program files you are likely to encounter in the wild--both for testing and dual usage for instanceperhaps the most common way you'll see the __name__ test applied is for self-test code in shortyou can package code that tests module' exports in the module itself by wrapping it in __name__ test at the bottom of the file this wayyou can use the file in clients by importing itbut also test its logic by running it from the system shell or via another launching scheme mixed usage modes__name__ and __main__