title: How to access a function contained within a class in another module
body: <p>This should be relatively simple, but I'm just missing something. I am trying to utilize a function from another module which is contained within a class. I can do it easily when there is no class involved. </p>
  
  <pre><code># a.py
  import b
  
  b.name()
  </code></pre>
  
  <p>--</p>
  
  <pre><code># b.py
  def name():
      print "What is your name?"
  
  class details(object):
  
      def age():
          print "What is your age?"
  </code></pre>
  
  <p>When I run a i get the expected result of</p>
  
  <p><em>What is your name?</em></p>
  
  <p>However when i try to access "def age()" from another module it keeps giving me trouble. </p>
  
  <p>Some of what I have tried so far...</p>
  
  <pre><code># c.py
  import b
  
  b.details.age()
  </code></pre>
  
  <p>= TypeError: unbound method age() must be called with details instance as first argument (got nothing instead)</p>
  
  <pre><code># c.py
  from b import details
  
  details.age()
  </code></pre>
  
  <p>= TypeError: unbound method age() must be called with details instance as first argument (got nothing instead)</p>
  
  <pre><code># c.py
  from b import details
  
  b.details(age)
  </code></pre>
  
  <p>= NameError: name 'b' is not defined</p>
  
  <p>I have tried a few others as well but too many to reasonably post. What am i doing wrong? What is the syntax to do do this? Is it even possible to execute a function when it is contained within a class in another module? </p>
  
  <p>Thanks in advance </p>
  
  <p><strong>EDIT:</strong> Fixed all tabs to spaces as suggested by Mike Graham</p>