title: How can I fix "TypeError: 'module' object is not callable"?
body: <p>I want to make a little snake game with Pygame. I've got a apple class but when I want to create the apple object I get that error: &quot;TypeError: 'module' object is not callable&quot;</p>
  <p>I have got absolutely no idea how I can fix it</p>
  <p>Class:</p>
  <pre><code>class Apple: 
      def __init__(self, surface, row, colum, scaller):
          self.surface = surface
          self.scaller = scaller
          self.x = int(map1d(row, 0, self.scaller, 0, width))
          self.y = int(map1d(colum, 0, self.scaller, 0, height))
  
      def show(self):
          pygame.draw.rect(self.surface, (255, 0, 0), (self.x, self.y), width / self.scaller / 2, height / self.scaler / 2)
  </code></pre>
  <p>map1d function:</p>
  <pre><code>def map1d(value, min_, max_, scalledMin, scalledMax):
      scaller = interp1d([min_, max_], [scalledMin, scalledMax])
      return scaller(value)
  </code></pre>
  <p>Main:</p>
  <pre><code>if __name__ == &quot;__main__&quot;:
      width = 700
      height = 700
      scaller = 35
  
      win = pygame.display.set_mode((width, height))
  
      #here I'm getting the error
      apple = Apple(win, random(scaller - 1), random(scaller - 1),                               scaller)
  </code></pre>
  <pre><code>Traceback (most recent call last):
    File &quot;sketch.py&quot;, line 48, in &lt;module&gt;
      apple = Apple(win, random(scaller - 1), random(scaller - 1), scaller)
  TypeError: 'module' object is not callable
  </code></pre>