title: how to fix Python pep 8 recommendations with pygame constants
body: <p><a href="https://i.stack.imgur.com/m11h9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/m11h9.png" alt="enter image description here"></a></p>
  
  <p>I have a problem with pep 8 and my Python code concerning Pygame constant on the next piece of code, which is sending me error E0602 "Undefined variable" when i use the pygame constant "KEYDOWN" "K_F1" K_ESCAPE"</p>
  
  <p>is there any trick to solve this problem with pep8</p>
  
  <p>I am a beginner and I admit that I do not find a solution to solve this problem :(</p>
  
  <pre><code>def run(self):
       """ start loop """
      loop = True
      while loop is True:
          self.windowSurface.blit(self.Sprite.home, (0, 0))
          self.pygame.display.flip()
              for event in pygame.event.get():
                  if event.type == KEYDOWN:
                      if event.key == K_F1:
                          loop = False
                      elif event.key == K_ESCAPE:
                          sys.exit(1)
  </code></pre>