title: Pygame: Issue stemming from an update() function using keyboard inputs
body: <p>I'm trying to create a two-player game in which each player is the object of a class. However, when I run my code, the command prompt gives me an error in line 43, saying that update() is missing a positional argument: &quot;function&quot;</p>
  <pre><code>class player(pygame.sprite.Sprite):
      lives = 5
  
      def __init__(self, left, right, img):
          super(player, self).__init__()
          self.surface = pygame.image.load(img).convert_alpha()
          self.rect = self.surface.get_rect()
          self.left = left
          self.left = right
  
      def update(self, function):
          if function[self.left]:
              self.rect.move_ip(-5, 0)
          if function[self.right]:
              self.rect.move_ip(5, 0)
  
  
  player1 = player(K_LEFT, K_RIGHT, &quot;jet1.png&quot;)
  player2 = player(K_a, K_d, &quot;jet2.png&quot;)
  
  
  open = True
  while open:
      for event in pygame.event.get():
          if pygame.key.get_pressed()[K_ESCAPE]:
              open = False
          elif event.type == QUIT:
              open = False
  
      pressed = pygame.key.get_pressed()
  
      player.update(pressed)
  
      display.blit(player1.surface, (width/4, height/4))
      display.blit(player2.surface, (.75 * width, .75 * height))
  </code></pre>
  <p>Also, when I take off the &quot;function&quot; argument in the update function, I get another error that says: 'pygame.key.ScancodeWrapper' object has no attribute 'left'</p>
  <p>I'm relatively new to Python and Pygame, so any help would be greatly appreciated!</p>