class A:
def p( self, msg ):
print( msg )
class B:
def __init__( self, a: A ):
self._p = a.p
def __call__( self, msg ):
self._p( msg )
a = A( )
b = B( a )
b( "Probando ..." )
def newp(self, msg):
print("---", msg)
A.p = newp
b( "Probando ..." )
c = B(a)
c("Probando ... ")