title: python - How to get list of instances of inner/nested class created only at one outer instance
body: <p>I have following code that defines outer and inner classes. I would like to get the instances of the inner class created under one specific instance of the outer class.</p>
  <pre><code>class schema():
      def __init__(self,name):
          self.name=name
      class node():
          nodes=[]
          def __init__(self,name):
              self.name=name
              self.nodes.append(self)
          def __call__(self):
              return(self.name)
  </code></pre>
  <p>When I create two instances of the class <code>schema</code> with two different instances of the inner class <code>node</code> <strong>I would like to get only the instances of the inner class associated to one of the outer instance</strong>.</p>
  <pre><code>a=schema('A')
  a1=a.node('A1')
  a2=a.node('A2')
  
  b=schema('B')
  b1=b.node('B1')
  b2=b.node('B2')
  
  print({n() for n in a.node.nodes})
  </code></pre>
  <p>I get:</p>
  <pre><code>{'B1', 'A1', 'B2', 'A2'}
  </code></pre>
  <p>But I would like to get:</p>
  <pre><code>{'A1', 'A2'}
  </code></pre>
  <p>Thank you.</p>