For exemple in the below example:
class myClass():
    def __init__(self):
        self.A = 1.
class essai():
    def __init__(self):
        self.C = myClass()
    def ref(self):
        mystring = 'C.A'
        nameclass, nameparam = mystring.split('.')
        print(nameclass, nameparam)
        print(getattr(getattr(self,nameclass),nameparam))
        Ref = getattr(getattr(self,nameclass),nameparam)
        print(Ref)
        self.modify_val(Ref,2)
        print(self.C.A)
    def modify_val(self,x,y):
        x=y
E=essai()
E.ref()
What I would like to do is getting the reference to the attribut A of the C class in essai. The point is I would like to use that reference to update the value of C.A in the method modify_val. By using a string that contains the class and the attribute I want modify (mystring = 'C.A'), I don't understand how I can get a reference to that attribute (C.A for instance) and how I can use that reference to modify the attribute. In my example, modify_val function don't update the C.A value because Ref is not acually a reference.
Therefore I get :
C A
1.0
1.0
1.0
I would like the last print to be 2
 
    