Real Python

Source Code: Click here to download the free source code that you’ll use to understand the name-main idiom.

Almost there! Complete this form and click the button below to gain instant access:

What Does if __name__ == "__main__" Do in Python?

What Does if __name__ == "__main__" Do in Python? (Source Code)

๐Ÿ”’ No spam. We take your privacy seriously.

ยฉ 2012โ€“2023 Real Python โ‹… Privacy Policy