I register plugins after what families I’ve written in the plugin classes docstring and in register_plugins i use pyblish.api.register_plugin(obj) only…
Then i show the gui, pyblish_lite.
So far everything works but when i run this script again but with different plugins the previous plugins will also show up in the GUI, together with the new plugins.
Calling
after registering the new plugins shows that only the new plugins are registered.
Then i proceed to show pyblish lite and there the new and old plugins show up.
register_plugins(docstring_families)
Looks like this, where pluginList contains full length paths to plugin .py files
I guess nevermind what i wrote about families, they get turned out into the paths that go into pluginList import imp def register_plugins(families):
…
#register the plugins
for pluginfile in pluginList:
module = imp.load_source('module.name', pluginfile)
for name, obj in inspect.getmembers(module):
if inspect.isclass(obj):
try:
pyblish.api.register_plugin(obj)
except:
pass
I can’t tell what’s happening there. imp.load_source is effectively what api.discover() does to registered plug-in paths already. Why not register their parent directory?
Maybe if you posted something I could run on my end that demonstrates the problem it would be easier to help.
It’s a long-shot, but somewhat related and potentially useful to your case; have you seen the latest feature on filtering the discovery of plug-ins that got added a few days ago?
from pyblish import api
class ExcludeMe(api.ContextPlugin):
order = api.CollectorOrder
class ChangeMe(api.InstancePlugin):
order = api.ValidatorOrder
optional = False
def my_filter(plugins):
for plugin in plugins[:]: # use [:] to avoid editing whilst looping
# Plug-ins can be removed..
if plugin.__name__ not in ("ChangeMe",):
plugins.remove(plugin)
# ..and modified
if plugin.__name__ == "ChangeMe":
plugin.optional = True
api.register_plugin(ExcludeMe)
api.register_plugin(ChangeMe)
api.register_discovery_filter(my_filter)
plugins = api.discover()
assert len(plugins) == 1
assert plugins[0] is ChangeMe
assert ChangeMe.optional is True
api.deregister_discovery_filter(my_filter)