python – How to restart game from end screen, rather than resume the previous game state?

Video as you can see there I am trying to make my end screen restart my game but whats happening is that its not restarting my game its just loading the same thing when I die >> how could I make it so it restarts my game when I click start game on my end screen?

my end screen def

---------------------------------------------------

def button(msg,x,y,w,h,ic,ac,action=None):
    mouse = pygame.mouse.get_pos()
    click = pygame.mouse.get_pressed()

    if x+w > mouse(0) > x and y+h > mouse(1) > y:
        pygame.draw.rect(window, ac,(x,y,w,h))
        if click(0) == 1 and action != None:
            action()         
    else:
        pygame.draw.rect(window, ic,(x,y,w,h))
    smallText = pygame.font.SysFont("comicsansms",20)
    textSurf, textRect = text_objects(msg, smallText)
    textRect.center = ( (x+(w/2)), (y+(h/2)) )
    window.blit(textSurf, textRect)

#------------------------------------------------------


def text_objects(text, font):
    textSurface = font.render(text, True, black)
    return textSurface, textSurface.get_rect()

def endScreen():
    red = (200,0,0)
    green = (0,200,0)
    bright_red = (255,0,0)
    bright_green = (0,255,0)

    intro = True
    while intro:
        for event in pygame.event.get():
            #print(event)
            if event.type == pygame.QUIT:
                pygame.quit()
                quit()

        window.fill((255,255,255))
        largeText = pygame.font.Font('BLOODY.ttf',100)
        TextSurf, TextRect = text_objects("You Have Died Fool", largeText)
        TextRect.center = ((800/2), (800/2))
        window.blit(TextSurf, TextRect)
        button("Start Game",150,450,100,50,green,bright_green,game_loop)

# make the square brighter if collideded with the buttons
        mouse = pygame.mouse.get_pos()
        if 150+120 > mouse(0) > 150 and 450+50 > mouse(1) > 450:
            pygame.draw.rect(window, bright_green,(150,450,120,50))
        else:
            pygame.draw.rect(window, green,(150,450,120,50))
        if 550+110 > mouse(0) > 550 and 450+50 > mouse(1) > 450:
            pygame.draw.rect(window, bright_red,(550,450,110,50))
        else:
            pygame.draw.rect(window, red,(550,450,110,50))
# ---------------------------------------------------------------------

        smallText = pygame.font.Font("freesansbold.ttf",20)
        textSurf, textRect = text_objects("Start Game", smallText)
        textRect.center = ( (150+(120/2)), (450+(50/2)) )
        window.blit(textSurf, textRect)


        smallText = pygame.font.Font("freesansbold.ttf",20)
        textSurf, textRect = text_objects("Quit Game", smallText)
        textRect.center = ( (150+(910/2)), (450+(50/2)) )
        window.blit(textSurf, textRect)


        pygame.display.update()
        clock.tick(15)



#----------------------------------------------------------


and on my main loop I said if my playerman health is > -1 it should load the end screen


            if playerman.health < -5:
                endScreen()

```