How can we access to outside of process method? [Solved]

Hello guys
After a long time i back to ask a question.


My problem here is that we have two step publishing with pyblish, from wip to publish folder that give the file version, date, and name of author, after that supervisor will open the first level published file and check it and again will publish in final folder.
now i want to change it to one step for supervisors, it means that when supervisor opened the wip version of file he can publish it in one step but into two place.

now i want to know that can i hide an integrator or validator or extractor from pyblish gui with having a series of conditions on families?

it means, based on some conditions, can i change families in the body of my plugin?

here, for example, i have a collector that will text that a user can save a file in final folder or not (he is supervisor or not), then based on it will save a data in context ([“fullPermission”].
i want to know that can i access to the data inside my plugin, and outside of process method?

Sample Code: :

import pyblish.api

class CollectPermissionNew(pyblish.api.ContextPlugin):
    order = pyblish.api.CollectorOrder
    hosts = ["maya"]
    label = "Collect Permission"

    def process(self, context):['fullPermission'] = False
        #['fullPermission'] = True'fullPermission: %s' %['fullPermission']) :

import pyblish.api

class ValidateTestCollectorNew(pyblish.api.InstancePlugin):
    order = pyblish.api.ValidatorOrder

        families = ['anr2.model',
        families = []

    hosts = ['maya']
    optional = True
    version = (0, 0, 1)
    label = "++TEST++"

    def process(self, instance):'Processing...')

this snippet does not work

        families = ['anr2.model',
        families = []

because we can’t access to["..."] in body of plugin.

do you think there is a way to do that and can change families??


Hi @Mahmoodreza_Aarabi,

Would it be possible to move your if logic to the process method?

from pyblish import api

class CollectPermissionNew(api.ContextPlugin):
    order = api.CollectorOrder - 0.1

    def process(self, context):["fullPermission"] = False
        #["fullPermission"] = True

class CollectInstances(api.ContextPlugin):
    order = api.CollectorOrder

    def process(self, context):
        instance = context.create_instance("MyInstance")["families"] = ["anr2.model"]


class ValidateModel(api.InstancePlugin):
    order = api.ValidatorOrder
    families = ["anr2.model"]

    def process(self, instance):"Validating model..")

class ValidateModelFinal(api.InstancePlugin):
    order = api.ValidatorOrder
    families = [""]

    def process(self, instance):"Validating final model..")


from pyblish import util
context = util.publish()

for result in["results"]:
    for record in result["records"]:

Now you can control the inclusion of ValidateModelFinal by toggling the fullPermission boolean.

Hello @marcus
Thanks for reply.
If it give me the toggle between showing or hiding our integrator or validator, yes, i can use it in process.
but in GUI i don’t know it does it for me or not.

Unfortunately i’m not at work to test it now, but do you think when a plugin is showing in list of plugins for a family can we hide it based on a

i mean when we want to process a plugin, we have it in our list, so how can we hide it from list when we are processing it?

make sense?

this is good idea to handle a family inside CollectInstance, i hope it works for me, i have to test it tomorrow and continue to talk.
i will be appriciated if you be here tomorrow.

Yes, in pyblish-qml plug-ins are automatically hidden if there is no instance with a compatible family. In pyblish-lite however it does not. @p4vv37 is working on this here.

I should say that i’m using Pyblish 1.3.1 yet
it works on it?
i didn’t upgrade yet.

and now i found that this line does not work for me
context = util.publish()

is it related to version of my publish?

Yes, this will work with 1.0 and above.

context = util.publish()
# Error: AttributeError: file <maya console> line 1: 'module' object has no attribute 'publish' #

BTW, i will test it tomorrow
i think it will work.
thanks man
see ya

My problem solved, i did this way and it works good

Excellent, happy to help!