def main():
pass # do stuff here
if __name__ == "__main__":
main()When a Python module is imported,
__name__is set to the module’s filename (without the.pyextension). This check ensures thatmain()runs only when the script is executed directly, not when it's imported as a module.