title: How does python variable inheritance work?
body: <p>I'm trying something very basic with Python inheritance:</p>
  <pre><code>class Parent:
      def __init__(self):
          self.text = 'parent'
  
      def getText(self):
          print self.text
  
  class Child1(Parent):
      def __init__(self):
          self.x = 'x'
  
  class Child2(Parent):
      def __init__(self):
          self.x = 'x'
  
  if __name__ == &quot;__main__&quot;: 
      parent = Parent()
      child1 = Child1()
      child2 = Child2()
  
      parent.getText()
      child1.getText()
      child2.getText()
  </code></pre>
  <p>but I keep getting</p>
  <blockquote>
  <p>Child1 instance has no attribute 'text'</p>
  </blockquote>
  <p>how are variables passed to children?</p>