<?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: Refresh Python script with ArcGIS Pro tool? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/refresh-python-script-with-arcgis-pro-tool/m-p/101941#M4162</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"I&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;re-run the tool (so I don't have to manually update all my parameters)"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;That is problem, the tool doesn't get refreshed, it is better to start a new instance of the tool.&amp;nbsp; And when testing, you can set defaults for the parameters.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;This is particularly important if there are imports in your script.&amp;nbsp; You can trigger a reload by adding 'reload' to your code&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; importlib &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; reload

&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; something_else

reload&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
reload&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;something_else&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is usually enough to restart the process&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 06:17:43 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-12-11T06:17:43Z</dc:date>
    <item>
      <title>Refresh Python script with ArcGIS Pro tool?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/refresh-python-script-with-arcgis-pro-tool/m-p/101940#M4161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm debugging some arcpy scripts that are failing when running in Pro (that's for another time). As a part of that process, I'm finding that when I make edits to my scripts in another IDE, the updated code is not being run when I re-run the tool in Pro. Because of this, I'm forced to reboot Pro every time I make a script edit which is really slow. Is there any other way to refresh the script within the tool?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To clarify, the process is:&lt;/P&gt;&lt;P&gt;- I run a tool within Pro that references a .py file&lt;/P&gt;&lt;P&gt;- I make changes to code within an IDE to the .py file referenced by the tool (and save, of course)&lt;/P&gt;&lt;P&gt;- in my Pro History tab, I re-run the tool (so I don't have to manually update all my parameters)&lt;/P&gt;&lt;P&gt;- the tool runs again, however it uses the code from before I made any edits in my IDE. i.e. it's not reflecting my edits&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jul 2020 20:01:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/refresh-python-script-with-arcgis-pro-tool/m-p/101940#M4161</guid>
      <dc:creator>DavidHeacock</dc:creator>
      <dc:date>2020-07-23T20:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Python script with ArcGIS Pro tool?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/refresh-python-script-with-arcgis-pro-tool/m-p/101941#M4162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"I&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;re-run the tool (so I don't have to manually update all my parameters)"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;That is problem, the tool doesn't get refreshed, it is better to start a new instance of the tool.&amp;nbsp; And when testing, you can set defaults for the parameters.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;This is particularly important if there are imports in your script.&amp;nbsp; You can trigger a reload by adding 'reload' to your code&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; importlib &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; reload

&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; something_else

reload&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
reload&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;something_else&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is usually enough to restart the process&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:17:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/refresh-python-script-with-arcgis-pro-tool/m-p/101941#M4162</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-12-11T06:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Python script with ArcGIS Pro tool?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/refresh-python-script-with-arcgis-pro-tool/m-p/101942#M4163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see how that's working, thanks for the reply and the snippet. I'm still running into the issue sometimes, even when creating a new instance of the tool. I'll try adding in some of the reload() functions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2020 15:12:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/refresh-python-script-with-arcgis-pro-tool/m-p/101942#M4163</guid>
      <dc:creator>DavidHeacock</dc:creator>
      <dc:date>2020-07-24T15:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Python script with ArcGIS Pro tool?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/refresh-python-script-with-arcgis-pro-tool/m-p/1176921#M55491</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/387524"&gt;@DavidHeacock&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Encountered the same issue. Had a main script that imported custom py modules containing code for classes. Was unable to get the tool to import the latest supporting module code properly, it is as if the module is cached somewhere and so changes made were/are never brought over. I could not trigger a refresh successfully until despite pointing to other scripts and coming back, copying the tool, and right clicking on the toolbox and using "Refresh". Nothing worked until restarted Pro. I put&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp;reload() into the script and now it appears to be importing the module each and every time. Knock on wood!&lt;/P&gt;&lt;P&gt;The reload call was the solution for me, fingers crossed it holds. Thanks&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/149008"&gt;@SusanHmel__DOIT_&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 16:50:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/refresh-python-script-with-arcgis-pro-tool/m-p/1176921#M55491</guid>
      <dc:creator>ConradSchaefer__DOIT_</dc:creator>
      <dc:date>2022-05-24T16:50:42Z</dc:date>
    </item>
  </channel>
</rss>

