title: calling class/static method from class variable in python
body: <p>I'm trying to make a ImageLoader class handle the loading and processing of image resources like this:</p>
  
  <pre><code>class ImageLoader:
      TileTable = __loadTileTable('image path', some other variable)
  
      @staticmethod
      def _loadTileTable(arg1, arg2):
          blah blah
  </code></pre>
  
  <p>however, on compile i get: <code>NameError: name '_loadTileTable' is not defined</code></p>
  
  <p>If i replace the second line with <code>TileTable = ImageLoader.__loadTileTable('image path', some other variable)</code> then i get <code>NameError: name 'ImageLoader' is not defined</code></p>
  
  <p>As i'm going from C# to Python, static classes with static methods is what i'd use to implement this. However, i'm open to how I'd do this in general in python (that is, call static library functions that are only grouped together by their functionality).</p>
  
  <p><strong>UPDATE:</strong>
  After reading both answers, I'm getting a picture that what i'm trying to do probably isn't right.
  How would I go about imlementing ImageLoader so that I can do this:</p>
  
  <p>Assuming that tile table returned an array</p>
  
  <p><strong>module1.py</strong></p>
  
  <pre><code>aTile = ImageLoader.TileTable[1]
  </code></pre>
  
  <p><strong>module2.py</strong></p>
  
  <pre><code>anotherTile = ImageLoader.TileTable[2]
  </code></pre>
  
  <p>ideally, i'd populate TileTable just once.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Thanks for all the answers, I found my last answer to populating TileTable just once in the python modules doco </p>
  
  <blockquote>
    <p>"A module can contain executable
    statements as well as function
    definitions. These statements are
    intended to initialize the module.
    They are executed only the first time
    the module is imported somewhere"</p>
  </blockquote>
  
  <p>As for static class, i'm going to forgo classes and just make a module level variable.</p>