__name__ is the context or scope of the current module the function is running in.
__main__ is the name of the entry module of a Python script.
Imagine that a
__main__ module is created automatically for you whenever you run a Python script.
if __name__ == '__main__': basically allows you to define functions that you want to (or not) run if the script is ran directly, or imported.