Untitled Document
if __name__ == __main__
1. Introduction Click Here
#********* Source Code From Website - Mangadaku - visit us at -http://mangadaku.com/ ***** 
# Introduction

print("This will always be run")

def main():
	print("First Module's Main Method")

if __name__ == '__main__':
	main()

       
2. Program - Example 2 Click Here
#********* Source Code From Website - Mangadaku - visit us at -http://mangadaku.com/ *****      
# Program -Example 2 

# IMP - if __name__ - Dunder Method will print the name of the program 
# __main__ - Dunder Method will check whether the program is executed by Python or it is being executed by 
# Import from another program 

Save Below Code as first_import.py 

print("This will always be run")

def main():
	print("First Module's Main Method")

if __name__ == '__main__':
	main()

print(f"This is Python File {__name__}")

# Save below code as 2.py  and execute it 

import first_import
print(f"This is {__name__}")
       
Untitled Document