__name__ == “__main__”

Hi,

I was just trying to understand more name == “main
What will happen if we give and don’t
https://www.geeksforgeeks.org/what-does-the-if-name-main-do/#:~:text=If%20you%20import%20this%20script,run%20directly%2C%20and%20not%20imported.

Like if we use standalone script then we need to give
name == “main
and execution starts from this line.

Thanks and Regards,
Subho

https://www.geeksforgeeks.org/what-does-the-if-name-main-do/

@subhobrata1 Instead of trying to explain this myself, I’ll do the sane thing and link you to Corey Schafer’s bite sized video which is by far the best explanation on this topic.

4 Likes

Thanks you for the link

It is basically to check if it run directly or import from another script

Thanks and Regards,
Subho