Let say I have the following script in modul1
:
class IN(object):
def __init__(self):
pass
class C(object):
def __init__(self, x):
pass
def func(self):
cl = IN()
Then I want to use C
class inside another script:
from modul1 import C
class IN(object):
def __init__(self):
pass
class C2(C):
def __init__(self, x):
C.__init__(self, x)
I can override C
class's func method by creating a method with the same name in C2
class.
But how can I override any call of modul1
's IN class inside of imported C
class with IN
class in the caller modul2
?
I want to change some functionality of original IN
class. I want C
class to call in the row
cl = IN()
my own IN()
class with the altered functionality.