When inheriting a Plug-in from another one it seems that any packages the original loaded in its file (e.g.
import os) don’t work anymore. As such any calls the plug-in made to those packages will not work and tell you a None type doesn’t have that method.
Not entirely sure if this is always easily reproducable. But in my case I’m doing something fairly simple. I have
pyblish_magenta on my
PYTHONPATH and loaded. From this package I inherit from the Alembic extractor in my own package. Upon loading both my plug-in overrides the original one, but it doesn’t process correctly.
from pyblish_magenta.plugins.pipeline import extract_alembic class ExtractAlembic(extract_alembic.ExtractAlembic): """This has been overridden""" @property def default_options(self): # Must import again, because the reference to the module disappears # once the plug-in has been loaded and is about to run this property.. from pyblish_magenta.plugins.pipeline import extract_alembic options = extract_alembic.ExtractAlembic.default_options.fget(self) # Include Colorbleed user-defined attributes options["attrPrefix"] = "cb" return options
Note that the “re importing there” is actually something that was a leftover from @marcus working on it. Funnily enough the comment is descriptive but doesn’t seem to fix this particular problem. I remember trying it also without that comment (not sure if that actually made a difference, will try again later today)
This comment by @marcus does give some direction to the issue that it’s likely related to how Pyblish loads a plug-in.
Other than the above I also tried just putting the imports of the original file at the top of this file, that also didn’t work.
Any idea on how to work around this?