title: gettar attribute error - Python
body: <p>I keep getting the following error when trying to use "getattr":</p>
  
  <p><em>AttributeError: 'str' object has no attribute 'displayTime'</em></p>
  
  <p>Here is the code I am using:</p>
  
  <pre><code>    getattr(className,"displayTime")(self)
  </code></pre>
  
  <p>where "className" refers to a string that I have taken from a list and is also the name of a subclass I have in my program. "displayTime" is a method within that subclass.</p>
  
  <p>I tried to test it by inputing the name of the subclass directly into it:</p>
  
  <pre><code>    getattr(seconds,"displayTime")(self)
  </code></pre>
  
  <p>and this worked fine. Does anyone have any ideas what I am doing wrong?</p>
  
  <p>Thank you.</p>