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

What part of the code you wrote do you think should be allowing the game not to exit the program?

The following conditions are what end up calling the game_over function and the game_over function calls the built-in quit function. So if you want something else to happen, I suggest not calling quit.

                    if snake_position[0] < 0 or snake_position[0] > window_x-10:
                    if snake_position[1] < 0 or snake_position[1] > window_y-10:
                    # Touching the snake body
                    for block in snake_body[1:]:
                        if snake_position[0] == block[0] and snake_position[1] == block[1]:

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.

What exactly do you want to happen when the snake game ends? Describe in detail from a user’s perspective.

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.