Python Tutorial: Learn if __name__ == '__main__' in 3 Minutes

Published: 15 March 2020
on channel: eMaster Class Academy
1,323
123

In Python, very often we write a module and execute it within the module directly. However, sometime, we want to import another module to support our module. In this situation, to avoid running the main program from the imported module, we need to use main check.

This main check help us to execute the main program only if we want to run the module directly, and make sure that the main program will not be executed when the module is being imported by others.


Watch video Python Tutorial: Learn if __name__ == '__main__' in 3 Minutes online, duration hours minute second in high quality that is uploaded to the channel eMaster Class Academy 15 March 2020. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 1,323 times and liked it 123 visitors.