ToolValidation Code (Python)

03-03-2016 01:04 PM
New Contributor II

I'm working on a ToolValidation Code (Python) and want to pass a result (values) from the function "updateParameters" to the function "updateMessages". Does anybody has good example how to do that?

0 Kudos
2 Replies
MVP Regular Contributor

Just off the top of my head, you could do something like the following using a python toolbox:

class SomeTool(object):
    def __init__(self):
        self.some_variable = None

    def getParameterInfo(self):
        return params

    def updateParameters(self, parameters):
        result = arcpy.ATool_SomeToolbox('somedata')
        self.some_variable = result.GetOutput(0)

    def updateMessages(self, parameters):
        if self.some_variable is not None:
            #Do something
            self.some_variable = None #reset the variable just in case
New Contributor II

Thanks for your idea, but I did not succeed with it. I made now an ugly workaround, but it works for the moment.

0 Kudos