title: How the added class can use the attributes of the main class?
body: <p>So, I have this class ComplexSystem. This class has its own attributes (attr_a in this example). It also has several elements. During another procedure, a method of the elements is called and attributes of the ComplexSystem are required for calculation of something. How should I do it? I have provided an example down here:</p>
  <pre><code>class ComplexSystem:
  
      def  __init__(self, attr_a):
          self.attr_a  = attr_a
          self.elements = []
  
      def add_element(self, element):
          self.elements.append(element)
  
  class Element:
  
      def do_something(self):
      ### I want to use the attr_a of the ComplexSystem here, what should I do?
  
  
  mySystem = ComplexSystem(&quot;foo&quot;)
  new_element = Element()
  mySystem.add_element(new_element)
  mySystem.elements[0].do_something()
  </code></pre>