I have an ArcGIS Pro toolbox tool based on a python script and am trying to have tool validation pre-fill values based on the location of the ArcGIS Toolbox location. Here is a screenshot of the tool:

enter image description here

This is my validation python code:

def updateParameters(self):
    """Modify the values and properties of parameters before internal
    validation is performed.  This method is called whenever a parameter
    has been changed."""

    rootpathname = os.path.dirname(os.path.abspath("__file__"))
    shorepathname = os.path.join(rootpathname, "Data\\Shoreline.gdb")
    templatepathname = os.path.join(rootpathname, "Symbology\\Representation Templates")

    if not self.params[1].altered:
        self.params[1].value = shorepathname

    if not self.params[3].altered:
        self.params[3].value = templatepathname


When I run the tool, neither of the parameters have been updated with the validation values; they simply remain blank. Why are my parameter values not updating?


2 Answers 2


Assuming you want to set defaults, i.e "pre-filled", just set them directly in getParameterInfo


def getParameterInfo(self):
    #Define parameter definitions

    # First parameter
    param0 = arcpy.Parameter(
        displayName="Input Features",

    param0.value = "blah"  # <=== Set default value

    return [param0]

updateParameters isn't changing your empty values because it doesn't fire until a parameter gets altered.

  • I tried this, and the parameters are still all blank when I open the tool.
    – spaine
    Commented Apr 10, 2020 at 17:19
  • 1
    @spaine this is directly from the documentation and definitely works. In my test tool, the parameters are filled when I open it. If yours do not, you have something not quite right. Edit your question and include your getParameterInfo code.
    – user2856
    Commented Apr 10, 2020 at 23:42
  • I've changed the nature of the question to identifying the location of ArcToolbox in Pro. The rest of the script is now working.
    – spaine
    Commented Apr 17, 2020 at 20:06
  • Please don't change your question after someone has answered it, Ask a new question.
    – user2856
    Commented Apr 21, 2020 at 8:12

Per ESRI Documentation, a list of parameters should be passed to the updateParameters method: This should be the same list returned by the getParameterInfo method. Then updateParameters looks like this (note that keyword "self" is not used):

def updateParameters(self, parameters):
    """doc string"""
    if not parameters[1].altered:
        parameters[1].value = shorepathname

    if not parameters[3].altered:
        parameters[3].value = templatepathname


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.