In this tutorial, you’ll learn all about Python’s name-main idiom. You’ll learn what it does in Python, how it works, when to use it, when to avoid it, and how to refer to it.

Read the full tutorial on Real Python:

What Does if name == “main” Do in Python?