title: Why is my game_loop not defined even though it is?
body: <p>I am making a start screen button where the game_loop starts when you press play, but it says game_loop is not defined, even though I thought I did. I can't seem to figure out the issue, so does anyone know how to fix this? It would help a lot! :)</p>
  
  <pre><code>def button(x, y, width, height, ic, ac, action=None):
      mouse = pygame.mouse.get_pos()
      # print(mouse)
  
      if x + width &gt; mouse[0] &gt; x and y + height &gt; mouse[1] &gt; y:
          pygame.draw.rect(screen, ac, (x, y, width, height), 0)
          for event in pygame.event.get():
              if event.type == pygame.MOUSEBUTTONDOWN and action is not None:
                  if action == 'play':
                      game_loop()
                  elif action == 'quit':
                      pygame.quit()
                      quit()
      else:
          pygame.draw.rect(screen, ic, (x, y, width, height), 0)
  
  def start_screen():
  
      start = True
  
      while start:
          clock.tick(FPS)
          for event in pygame.event.get():
              if event.type == pygame.QUIT:
                  pygame.quit()
                  quit()
              if event.type == pygame.KEYUP:
                  start = False
  
          screen.blit(background, background_rect)
  
          button(180, 285, 120, 60, BLUE, LIGHT_BLUE, 'play')
          button(202, HEIGHT - 150, 80, 40, WHITE, GRAY, 'quit')
          button(310, 45, 140, 30, WHITE, GRAY)
          button(20, 45, 140, 30, WHITE, GRAY)
  
          draw_text(screen, "Shoot 'Em Up", 80, WIDTH / 2, HEIGHT / 4, WHITE)
          draw_text(screen, "Instructions", 30, 90, 53, BLACK)
          draw_text(screen, "Credits", 35, 378, 50, BLACK)
          draw_text(screen, "Play", 55, WIDTH / 2, HEIGHT / 2, WHITE)
          draw_text(screen, "Quit", 30, WIDTH / 2, HEIGHT - 137, BLUE)
  
          pygame.display.flip()
  
  start_screen()
  running = True
  
  def game_loop():
      while running:
          *game_loop code*
  game_loop()
  </code></pre>