Isinstance() function issue in modular project scripts

I've noticed the isinstance() function operating in an unexpected way across project library scripts. I've recreated my issue with a simplified example. I have one script with two classes test.Chair and test.Table. I ALWAYS want the Table.chair attribute to store a Chair object, but I want to allow the developer to input either a Chair object or the 'chairName' string as a parameter to the Table object. To accomplish this I have a method in another module 'testAux' that accepts the 'chair' variable passed into the Table object and checks to see if it is an instance of test.Chair. If it isn't, it will create and return a Chair object with the variable passed as its 'chairName'.


The issue is that isinstance(chair, test.Chair) always returns false. The behavior, therefore, of the getChairObj() function is to instantiate and return a Chair object with another Chair object stored in 'chairName'.

Why isn't the isinstance() function recognizing a Chair object as a test.Chair instance?

Hey Josh_Davidson,

If I'm not mistaken the function is running as intended. I would assume c.chairName to be the original object 'chair' and table.chair.chairName.chairName would then be the subclass. I would recommend making a support post so our reps can look into the isinstance() function further. You can reach out to our support department via Inductive Automation Support.