Python: Call for value inside nested class
<p>I'm trying to call for value from class B that is nested in class A and use it in class C.
I'm getting AttributeError:</p>

<pre><code>class A():
    class B():
        a = 1
    class C():
        b = 2
        c = B.a + b 
AttributeError: class B has no attribute 'a'
</code></pre>

<p>I also tried to call From 'A', Pycharm recognize it, but python still get AttributeError:</p>

<pre><code>class A(object):
    class B(object):
        a = 1
    class C(object):
        b = 2
        c = A.B.a + b 
AttributeError: class A has no attribute 'B'
</code></pre>

<p>Does someone have an idea of how to use it?
Thanks</p>

<p>At compile time, the class definition for class A is not complete hence you can not access the classes, variables and methods defined in a parent class inside a nested class.</p>

<p>You can try separating the class definitions though as suggested by @Reut Sharabani.</p>

python