I've got class A and its inner class B
They're in different files(suppose a.py and b.py)
I need to change A.x in method of class B without sending "self". I.e. self.inner = B() and not self.inner = B(self). I can't send "self" because class A is in generated file that I mustn't touch.
How do I do it?
That's how I'd do it if I could send self
#a.py
from b import B
class A():
def __init__(self):
self.x = 1
#this would be self.inner = B() instead
self.inner = B(self)
example = A()
print(example.x)
#b.py
class B():
def __init__(self, parent):
self.change(parent)
def change(self, parent):
parent.x = 2