pyblish / pyblish-base

Pyblish base library - see https://github.com/pyblish/pyblish for details.
Other
127 stars 59 forks source link

Renaming plugin class doesn't update #106

Closed tokejepsen closed 9 years ago

tokejepsen commented 10 years ago
mottosso commented 9 years ago

Some more info on this.

Running the included example of Pyblish Maya and publishing with ExtractModelAsObj works well. Then renaming it to ExtractModelAsObj2 produces duplicate plug-ins; one by the original name, and one using the old.

This occurs in both logging and the Pyblish QML GUI.

Hunting this down now.

mottosso commented 9 years ago

This looks to be due to a particularity in how the Python import mechanism works and was difficult to test and thus difficult to fix.

Marking this as a minor inconvenience for now.

mottosso commented 9 years ago

Encountered a solution to this on the interwebs just now by chance.

Apparently, the Python import mechanism implicitly "merges" a module with another is another one of the same name is already in sys.modules, which is the case here as the plug-in class changed, but the file did not, resulting in two classes.

The solution was simple (though hacky). Remove it from sys.modules before importing it again.