title: Python class - create instance of nested dictionary
body: <p>I am trying to create class that will take a dictionary as input, and then that be used as input to the same class (effectively creating a nested dictionary with class methods):</p>
  <p>Here is what I have so far:</p>
  <pre><code>class popl(object):
          def __init__(self,d):
              self.__dict__= d
  
  dic = {'x':[1,2,3], 'y':[4,5,6]}
  # Inner dict
  inner = popl(dic)
  </code></pre>
  <p>Now I can do: <code>inner.x</code> to access the elements.
  Then I want to be able to create a new dictionary <code>outer</code> consisting of <code>inner</code>, and access the elements as: <code>outer.inner.x</code></p>
  <p>I tried:</p>
  <pre><code>outer=popl(inner)
  </code></pre>
  <p>but I am getting an error:</p>
  <pre><code>TypeError: __dict__ must be set to a dictionary, not a 'popl'
  </code></pre>
  <p>Any idea how to achieve what I want? Do I need a nested class instead?</p>