<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Reordering Parameters in scripting tools in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/reordering-parameters-in-scripting-tools/m-p/1175389#M64584</link>
    <description>&lt;P&gt;My understanding is that you need to move it to parameter#3 and then update all the references in you code to parameters[3] (or parameters[2])&lt;/P&gt;</description>
    <pubDate>Thu, 19 May 2022 00:28:00 GMT</pubDate>
    <dc:creator>I_AM_ERROR</dc:creator>
    <dc:date>2022-05-19T00:28:00Z</dc:date>
    <item>
      <title>Reordering Parameters in scripting tools</title>
      <link>https://community.esri.com/t5/python-questions/reordering-parameters-in-scripting-tools/m-p/1175379#M64583</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm wondering how to reorder my parameters in a scripting tool.&lt;/P&gt;&lt;P&gt;For example, I just added Parameter #10, but I want it to show up 3rd when the user opens the tool. Is this possible to do?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 23:39:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reordering-parameters-in-scripting-tools/m-p/1175379#M64583</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2022-05-18T23:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: Reordering Parameters in scripting tools</title>
      <link>https://community.esri.com/t5/python-questions/reordering-parameters-in-scripting-tools/m-p/1175389#M64584</link>
      <description>&lt;P&gt;My understanding is that you need to move it to parameter#3 and then update all the references in you code to parameters[3] (or parameters[2])&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2022 00:28:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reordering-parameters-in-scripting-tools/m-p/1175389#M64584</guid>
      <dc:creator>I_AM_ERROR</dc:creator>
      <dc:date>2022-05-19T00:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Reordering Parameters in scripting tools</title>
      <link>https://community.esri.com/t5/python-questions/reordering-parameters-in-scripting-tools/m-p/1175427#M64586</link>
      <description>&lt;P&gt;Assuming you are using a custom toolbox (*.tbx), right click your script in the toolbox and select "Properties", select the parameters tab and then right click on the parameter you want to move and select "Move up" or "Move down".&amp;nbsp;And then change the parameter references in your code.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Luke_Pinner_0-1652935299382.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/41698i8B2DD67FE44C2889/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Luke_Pinner_0-1652935299382.png" alt="Luke_Pinner_0-1652935299382.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you're actually using a Python Toolbox (*.pyt) then it's easier, just move the parameters around in your tool `getParameterInfo` method and then refer to the parameters by name using a dict or namedtuple&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;class Tool
    etc...
    
    def execute(self, parameters, messages):
        parameters = {p.name: p for p in parameters}
        # do something with parameters["some_name"]

# Or
from collections import namedtuple

class Tool
    etc...

    def execute(self, parameters, messages):
        parameters = namedtuple('Parameters', (p.name for p in parameters))(*parameters)
        # do something with parameters[0] or parameters.some_name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also recommend voting for the following idea:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/make-python-toolbox-parameters-a-namedtuple/idi-p/1133743/highlight/true" target="_self"&gt;ArcGIS Pro Ideas - Make Python Toolbox parameters a namedtuple instead of a list&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2022 05:06:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reordering-parameters-in-scripting-tools/m-p/1175427#M64586</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2022-05-19T05:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: Reordering Parameters in scripting tools</title>
      <link>https://community.esri.com/t5/python-questions/reordering-parameters-in-scripting-tools/m-p/1175618#M64590</link>
      <description>&lt;P&gt;Thanks for the response.&lt;/P&gt;&lt;P&gt;Unfortunately, that is exactly what I am trying to avoid; moving the parameters manually like that means I have to change every other reference. So #10--&amp;gt;3, #3--&amp;gt;4, #4--&amp;gt;5, etc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been able to get around it partially by using categories, but that's not viable for everything.&lt;/P&gt;&lt;P&gt;I thought I saw something the other week about parameter order independent of its index position but I guess not. I'll leave this up for another day or so just in case and then mark you as the solution.&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2022 16:31:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reordering-parameters-in-scripting-tools/m-p/1175618#M64590</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2022-05-19T16:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: Reordering Parameters in scripting tools</title>
      <link>https://community.esri.com/t5/python-questions/reordering-parameters-in-scripting-tools/m-p/1330842#M68711</link>
      <description>&lt;P&gt;Unfortunately not a solution for scripting tools, but for python toolboxes, the parameter order can be changed by moving the parameters around in the params list.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlfredBaldenweck_0-1695243559880.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/81260i2B8A0DC2E8F647A1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlfredBaldenweck_0-1695243559880.png" alt="AlfredBaldenweck_0-1695243559880.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 20:59:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reordering-parameters-in-scripting-tools/m-p/1330842#M68711</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2023-09-20T20:59:29Z</dc:date>
    </item>
  </channel>
</rss>

