title: AttributeError: 'module' object has no attribute
body: <p>I have looked at other posts here on this topic and not found a clear answer, though I'm sure its something simple.</p>
  
  <p>My code has the following structure...</p>
  
  <pre><code>import matplotlib
  ...
  ...
  
  class xyz:
      def function_A(self,...)
          ...
          ...
          fig1 = matplotlib.figure()
          ...
          ...
  </code></pre>
  
  <p>I am calling 'function_A' from an instance of 'xyz' and when I do I get the error message:</p>
  
  <pre><code>AttributeError: 'module' object has no attribute 'figure'
  </code></pre>
  
  <p>Based on the posts I have read it seems like a problem with the way I'm importing matplotlib, but I can't sort it out. I have tried importing it within the Function_A definition (I think that is bad form but I wanted to test it), but I still the the same error.</p>
  
  <p>I have used my 'function_A' code elsewhere with no problem, but it was just a function in a module, not a method in a class.</p>
  
  <p>Any help is appreciated!</p>