Branching II

Let's look at a more interesting branching technique.

import pyblish.api

items = ["john", "door"]

class CollectInstances(pyblish.api.ContextPlugin):
  order = 0

  def process(self, context):
    for item in items:

class PrintInstances(pyblish.api.InstancePlugin):
  order = 1

  def process(self, instance):
    print("Instance is: %s" % instance)


import pyblish.util
# The instance is "john"
# The instance is "door"

In this case, PrintInstances will run once for every instance. That's because we subclassed InstancePlugin instead of ContextPlugin.

These two superclasses form the foundation upon which all of Pyblish is built, we'll have a much closer look these at in the following examples.


Last updated