Snake game only works by itself not when i move to other repls

Why does the same code not work in other repls?
Repl link:
Original link =
The one I moved the code to = (fork it to see code)

code snippet

Well, do you know what the code:

if __name__ == "__main__":
    game = Game()

It makes it so that the code is only run if it is in the main “entrypoint” file (which in replit, is usually
Just remove the if statement, you don’t need that check inside of a function.

1 Like

thanks i was playing around a bit with ai so i didn’t look at it correctly。

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.