title: Calling class function from module?
body: <p>I am just writing some dummy code for pygame.</p>
  
  <p>The first sample of code has a function in the menus.py file. I wanted to practice using import. This works fine. I then wanted to put the function in a class so I can get up and running with classes. This is the second block of code. Unfortunately the second block of code doesn't run. Could someone explain where I am going wrong please.</p>
  
  <pre><code># menus.py
  def color_switcher(counter, screen):
      black = ( 0, 0, 0)
      white = (255, 255, 255)
      green = (0, 255, 0)
      red = (255, 0, 0)
  
      colors = [black, white, green, red]
      screen.fill(colors[counter])
  
  # game.py
  
  #stuff
  if event.type == pygame.MOUSEBUTTONDOWN:
       menus.color_switcher(counter, screen)
       #more stuff
  </code></pre>
  
  <p>This works fine.</p>
  
  <p>This doesn't</p>
  
  <pre><code># menus.py
  class Menu:
  
      def color_switcher(self, counter, screen):
          black = ( 0, 0, 0)
          white = (255, 255, 255)
          green = (0, 255, 0)
          red = (255, 0, 0)
  
          colors = [black, white, green, red]
          screen.fill(colors[counter])
  
  # game.py
  
  #stuff
  if event.type == pygame.MOUSEBUTTONDOWN:
       menus.Menu.color_switcher(counter, screen)
       #more stuff
  
  #TypeError: unbound method color_switcher() must be called with Menu instance as first argument (got int instance instead)
  </code></pre>
  
  <p>Could someone tell me what I am doing wrong with the class please?</p>