I have been looking for an answer to this, but no luck yet. I need to have a child class access the value of a property in its parent class.
Here's an example:
class myclass:
    def __init__(self):
        class __firstinternal__:
            def __init__(self):
                self.second = __secondinternal__()
        class __secondinternal__:
            def __init__(self):
                self.var = myclass.getString()
    def getString(self):
        return "something"
    self.internal = __firstinternal__()
    print self.internal.second.var
c = myclass()
Traceback (most recent call last):
  File "./inheritest.py", line 19, in <module>
    c = myclass()
  File "./inheritest.py", line 15, in __init__
    self.internal = __firstinternal__()
  File "./inheritest.py", line 7, in __init__
    self.second = __secondinternal__()
  File "./inheritest.py", line 11, in __init__
    self.anothervar = myclass.getString()
AttributeError: class myclass has no attribute 'getString'
In other words, I need secondinternal to inherit the method getString() from the parent myclass.
I have found how to do this when the class is not a child, but I want to keep the two classes private.
Any ideas?
Thanks in advance!
 
     
     
    