Consider you have two python files as defined below. Say one is a general package (class2), and the other one does specific overrides and serves as the executab
Thanks for the hints, which finally helped me to experiment in the right direction. The solution I just found in this toy model, is to fix the namespace issue using an import. In order to rule out the issue user4815162342 pointed out, I added another class to class1. The following code for class1.py appears to do, what I want:
#!/usr/bin/python
class Test(object):
pass
class Toast(object):
pass
class Verificator():
def check(self, myObject):
if not isinstance( myObject, Test ):
print "NOPE: %s is no instance of %s" % (type(myObject),Test)
else:
print "OK: %s is instance of %s" % (type(myObject),Test)
if __name__ == '__main__':
from class2 import getTest
from class1 import Test, Toast
v = Verificator()
t = Test()
v.check(t)
t = getTest()
v.check(t)
t = Toast()
v.check(t)