title: About importing modules in python
body: <p>I have three modules in the same folder.</p>
  
  <p>The first module, run.py, is the main program.</p>
  
  <p>The second module, called shapes.py, contains a class called "Shape"</p>
  
  <p>The third module, called circles.py, that contains a class called "Circle" which inherits from Shape.</p>
  
  <p>The code is written as follows</p>
  
  <p>run.py</p>
  
  <pre>
  from shapes import Shape
  from circles import Circle
  
  a = Circle()
  a.print_test()
  </pre>
  
  <p>shapes.py</p>
  
  <pre>
  class Shape(object):
  
      def print_name(self):
  
          print "I am a generic shape"
  </pre>
  
  <p>circles.py</p>
  
  <pre>
  class Circle(Shape):
  
      def print_name(self):
  
          print "I am a circle"
  </pre>
  
  <p>I want to be able to run the program and have the console say "I am a circle", but it throws an exception when importing circles saying that "Shape is not defined".</p>
  
  <p>I can always tell circles.py to import the Shape class, but that's not what I want. What if they're not in the same folder? What if there's a complicated hierarchy of folders?</p>
  
  <p>It feels like I'm importing the shapes module twice that way unnecessarily just so that I can import circles.</p>
  
  <p>What can I do? (well, in this case, run.py probably doesn't even need to import Shape, but if I had some other modules "triangles", "hexagons", and "pentagons" I don't want them all to have to import Shape)</p>
  
  <p>EDIT: I could also just put them all in the same module cause they're shapes! But this sort of problem might arise some time.</p>