title: Python 'module' object is not callable issue trying to import module a few different ways
body: <p>I recently took over maintaining a website that is written in Python and uses web.py.  I've created a class I would like to import but I'm getting the "TypeError: 'module' object is not callable" error.  All the .py modules are stored in a directory call "lib".  In the lib directory are the following modules - noun.py, verb.py, context.py, word.py, base.py.  Within the lib directory is the --init--.py file.  I'm trying to import the noun.py module into the context module.  Below is the code in the context.py module that is used to import the other modules.</p>
  
  <pre><code>from lib import verb, word, base
  </code></pre>
  
  <p>This seems to work fine for importing the verb, word and base modules.  But when I add noun to the end of that statement to make it...</p>
  
  <pre><code>from lib import, verb, word, base, noun
  </code></pre>
  
  <p>I get the "TypeError: 'module' object is not callable" error.  I've also tried...</p>
  
  <pre><code>import noun #Also produces the same error
  </code></pre>
  
  <p>So I tried the following...</p>
  
  <pre><code>from noun import *
  </code></pre>
  
  <p>When I import the module this way the error is eliminated but when I reference an attribute of the noun module I get the error "AttributeError: noun instance has no attribute 'get_stem_used'".  Below is the code from the noun module...</p>
  
  <pre><code>from base import base
  
  class noun:
      wordBase = None
      stemBase = None
  
      def __init__(self, pId):
          b = base()
          wrdBase = b.get_word_base(pId)
          self.wordBase = wrdBase['base']
          stmBase = b.get_stemBase(pId)
          self.stemBase = stmBase['stem']
          #Code to make sure the module is instantiated correctly and the data is validated
  
      def get_output(self):
          return self.wordBase
  
      def get_stem_used(self):
          return self.stemBase
  </code></pre>
  
  <p>The verb.py module has essentially the same code as the noun.py module.  In the context.py module I have the following code...</p>
  
  <pre><code> n = noun(id)
   base = n.get_output()
   #I print out base to make sure everything is good and it is
  
   v = verb(id)
   verb = v.get_output()
  </code></pre>
  
  <p>"n" and "v" are then passed to the word.py module.  Within the word.py module is the following code.</p>
  
  <pre><code>if v.get_stem_used == "Some Value":
      #do whatever
  elif n.get_stem_used == "Another value":  #This line produces the "attribute error"
      #do something
  </code></pre>
  
  <p>When I try to access n.get_stem_used I get the "AttributeError: noun instance has no attribute 'get_stem_used'" error.  I've done some research and I ran into this url <a href="http://effbot.org/zone/import-confusion.htm" rel="nofollow">http://effbot.org/zone/import-confusion.htm</a> this leads me to believe that I'm not properly importing the noun module and since I'm not importing the noun module using the following code...it won't allow me to refer to the elements with the noun class using the dot notation.</p>
  
  <pre><code>from lib import, verb, word, noun
  </code></pre>
  
  <p>It's weird to me that adding "noun" to the end of the above statement isn't working but it seems to properly import all the other modules.  I've seen that mixing tabs and spaces can cause this error but I've checked using my editor that it is properly tabbed.  I've been working on this for a while so any help is greatly appreciated.  Thanks.</p>
  
  <p>Below is what is in the --init--.py</p>
  
  <pre><code>#!/usr/local/bin/python2.5
  # -*- coding: utf-8 -*-
  </code></pre>