Code in if __name__ == '__main__' runs twice?

So, this SO post came up in my search, but I was hung up on the behavior described:

If you set use_reloader to False you’ll see the behaviour go away, but then you also lose the reloading functionality.

I assumed that “reloading functionality” meant that I wouldn’t be able to update the page, refresh, live update, etc. In actuality, I believe this is purely about the functionality in which editing the file while the server is running triggers a refresh. I can absolutely live without that, so app.run_server(use_reloader=False) is what I went with.

1 Like