I've got a problem with isinstance and I've reduced it to this case.
I have two files.
main.py:
import testType
class TestClass:
def __init__(self):
pass
if __name__ == '__main__':
test_class = TestClass()
testType.test_type(test_class)
and testType.py
from main import TestClass
def test_type(obj):
print(type(obj), TestClass)
print(isinstance(obj, TestClass))
And I've got:
<class '__main__.TestClass'> <class 'main.TestClass'>
False
Why?
How should I fix it?