Files
Plug-ins can also be stored as files.
1
myplugins
2
├── myplugin1.py
3
└── myplugin2.py
Copied!
Here is the full source code.
1
# myplugin1.py
2
import pyblish.api
3
4
class MyPlugin1(pyblish.api.ContextPlugin):
5
def process(self, context):
6
print("hello from plugin1")
Copied!
1
# myplugin2.py
2
import pyblish.api
3
4
class MyPlugin2(pyblish.api.ContextPlugin):
5
def process(self, context):
6
print("hello from plugin2")
Copied!
You then register their parent directory, similar to how you would normally register Python modules.
1
# Environment Variables: Windows
2
$ set PYBLISHPLUGINPATH=c:\myplugins;\\server\moreplugins
3
4
# Environment Variables: Unix
5
$ export PYBLISHPLUGINPATH=/myplugins:/moreplugins
Copied!
You can also register from Python.
1
import pyblish.api
2
pyblish.api.register_plugin_path(r"c:\myplugins")
Copied!
Once registered, the plug-ins are triggered upon the next publish.
1
import pyblish.util
2
pyblish.util.publish()
3
# hello from plugin1
4
# hello from plugin2
Copied!
See also
Last modified 1yr ago
Copy link