Pyblish By Example
1.8
1.8
  • Introduction
  • Hello World
  • Quickstart
  • Files
  • Coordination
  • Architecture
  • Branching I
  • Branching II
  • Branching III
  • Sharing
  • Validating I
  • Validating II
  • CVEI I
  • CVEI II
  • CVEI III
  • CVEI IV
  • Data
  • Report I
  • Report II
  • Report III
  • Report IV
  • Report V
  • Callback I
  • Callback II
  • Callback III
  • Logging
  • Filtering
  • Next Steps
Powered by GitBook
On this page

Was this helpful?

Files

Plug-ins can also be stored as files.

myplugins
├── myplugin1.py
└── myplugin2.py

Here is the full source code.

# myplugin1.py
import pyblish.api

class MyPlugin1(pyblish.api.ContextPlugin):
  def process(self, context):
    print("hello from plugin1")
# myplugin2.py
import pyblish.api

class MyPlugin2(pyblish.api.ContextPlugin):
  def process(self, context):
    print("hello from plugin2")

You then register their parent directory, similar to how you would normally register Python modules.

# Environment Variables: Windows
$ set PYBLISHPLUGINPATH=c:\myplugins;\\server\moreplugins

# Environment Variables: Unix
$ export PYBLISHPLUGINPATH=/myplugins:/moreplugins

You can also register from Python.

import pyblish.api
pyblish.api.register_plugin_path(r"c:\myplugins")

Once registered, the plug-ins are triggered upon the next publish.

import pyblish.util
pyblish.util.publish()
# hello from plugin1
# hello from plugin2

See also

PreviousQuickstartNextCoordination

Last updated 5 years ago

Was this helpful?

Task-based plug-in registration