If you can put the variable inside of a class instance, then we can do it.
Instance variables are nice because we have total control over them. We can always control what happens when assigning to them. This is exactly what properties are for.
class Example:
def __init__(self):
self._impl = "value"
@property
def Stringtoknow(self):
return self._impl
@Stringtoknow.setter
def Stringtoknow(self, v):
self._impl = v
print("the value changed")
example = Example()
print(example.Stringtoknow)
example.Stringtoknow = "new value"
print(example.Stringtoknow)