Why when The snake game ends the whole main program ends

I am creating a big program, so first there is a cmd var that asks for an input but when I type in snake_game it runs the problem is whenever the whole snake game ends the whole program ends like the cmd var ends. Here is the GitHub.

I want for when the program ends, the cmd appears again, so the user can keep typing other commands

The part where the game ends

I have tried calling sys.exit() but that ends up with the same result, and I have also tried looping the game then calling a break when the game ends. But the loop just does not work because it is called within the def() function. So I have no clue honestly of what to do now.

Step 1. User enters snake_game

Step 2. User plays the game

Step 3. User Losses

Step 4. Window automatically closes after set amt of time

Step 4. The program automatically returns to the >>> for the user to type more commands.

I have already done step 1-4.

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