So there is a class called ClassInOtherCode
in module othercode.py
that I cannot alter. In othercode.py
there is a function called otherfunc()
that sometimes instantiates ClassInOtherCode
.
Before I run otherfunc()
is there a way to tell Python to tell my code via some raised event or call some code of mine when ClassInOtherCode
is instantiated?
I am not referring to my code checking if ClassInOtherCode
is instantiated after the call to otherfunc()
, but rather a push by Python to my code. By push, I am referring to a web pattern whereby the client browser receives info rather than continually asking for it.
My code is not a web app. I'm just trying to make an analogy so my question is hopefully clearer.