<?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 Why does symbology applied with Python Script tool in Pro revert to default symbology when the script tool finishes? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/why-does-symbology-applied-with-python-script-tool/m-p/682557#M52856</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to put together a custom version of a cut-fill tool that ends with adding the symbolized raster to a map in pro, if there is an active map.&amp;nbsp; If I watch the table of contents while the script is running, the raster is added to the map and the symbology (classified, three classes&amp;nbsp;based on VOLUME field) is successfully applied.&amp;nbsp; However, between when the script finishes and the tool overall finishes, the symbology reverts to what would be the default symbology for the raster (stretch based on Value field).&amp;nbsp; &amp;nbsp;I&amp;nbsp;tried setting arcpy.env.addOutputsToMap = False thinking that a tool's default behavior to add the output back to the map may be messing up the symbology, but that didn't change anything.&amp;nbsp;&amp;nbsp;&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="comment token"&gt;#Note that outCF is the output raster defined earlier in the script.  &lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Add symbolized raster to map&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#First, define the symbology based on a lyrx file--3 classes, breaking at 0&lt;/SPAN&gt;
Temp_Symbology &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dirname&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;abspath&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;__file__&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Symbology_Template.lyrx'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;#Gets the path of the script file because the lyrx file is in the same folder&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#Create variables referring to active map and dataframe&lt;/SPAN&gt;
p &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CURRENT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#Look if there's an active map.  If there isn't, i.e. m == None, then just skip the symbology.&lt;/SPAN&gt;
m &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; p&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;activeMap
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; m &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;#Add layer to top of active dataframe.&lt;/SPAN&gt;
    lyr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; m&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;addDataFromPath&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outCF&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;#arcpy.AddMessage("Layer name: %s" %lyr)&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;#Apply symbology from a layer file.&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ApplySymbologyFromLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Temp_Symbology&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;


&lt;SPAN class="comment token"&gt;#Calculate whole process run time in minutes&lt;/SPAN&gt;
processEnd &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;time&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;time&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; processStart&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;60&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Script took %s minutes to complete"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt;processEnd&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;/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;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;I've seen some other discussion here about a bug with the apply symbology from layer gp tool not working in python scripts in, but I don't think that's the case here because it is applied then reverts. I also tried a different approach for adding and symbolize the raster in case &lt;STRONG style="color: #ff0000; background-color: #ffffff; border: 0px; font-weight: bold;"&gt;BUG-000108497&lt;/STRONG&gt;&amp;nbsp;is still affecting things in version 2.4.1 which I'm running.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;lf &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;LayerFile&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Temp_Symbology&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
m&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;addLayer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lf&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"TOP"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
m&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateConnectionProperties&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Temp_Symbology&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;outCF&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result looks as follows.&amp;nbsp; When the last line of my script--the printing message with a total run time--executes the symbology from the layer has been applied.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/472753_ProScreenshot1.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Moments later, when the tool dialog prints that it has successfully completed, the symbology of the output has changed back to a stretch.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji jive-image image-2 j-img-original" src="https://community.esri.com/legacyfs/online/472760_ProScreenshot2.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 04:43:02 GMT</pubDate>
    <dc:creator>JakeSlyder1</dc:creator>
    <dc:date>2021-12-12T04:43:02Z</dc:date>
    <item>
      <title>Why does symbology applied with Python Script tool in Pro revert to default symbology when the script tool finishes?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-symbology-applied-with-python-script-tool/m-p/682557#M52856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to put together a custom version of a cut-fill tool that ends with adding the symbolized raster to a map in pro, if there is an active map.&amp;nbsp; If I watch the table of contents while the script is running, the raster is added to the map and the symbology (classified, three classes&amp;nbsp;based on VOLUME field) is successfully applied.&amp;nbsp; However, between when the script finishes and the tool overall finishes, the symbology reverts to what would be the default symbology for the raster (stretch based on Value field).&amp;nbsp; &amp;nbsp;I&amp;nbsp;tried setting arcpy.env.addOutputsToMap = False thinking that a tool's default behavior to add the output back to the map may be messing up the symbology, but that didn't change anything.&amp;nbsp;&amp;nbsp;&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="comment token"&gt;#Note that outCF is the output raster defined earlier in the script.  &lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Add symbolized raster to map&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#First, define the symbology based on a lyrx file--3 classes, breaking at 0&lt;/SPAN&gt;
Temp_Symbology &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dirname&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;abspath&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;__file__&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Symbology_Template.lyrx'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;#Gets the path of the script file because the lyrx file is in the same folder&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#Create variables referring to active map and dataframe&lt;/SPAN&gt;
p &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CURRENT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#Look if there's an active map.  If there isn't, i.e. m == None, then just skip the symbology.&lt;/SPAN&gt;
m &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; p&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;activeMap
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; m &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;#Add layer to top of active dataframe.&lt;/SPAN&gt;
    lyr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; m&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;addDataFromPath&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outCF&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;#arcpy.AddMessage("Layer name: %s" %lyr)&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;#Apply symbology from a layer file.&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ApplySymbologyFromLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Temp_Symbology&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;


&lt;SPAN class="comment token"&gt;#Calculate whole process run time in minutes&lt;/SPAN&gt;
processEnd &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;time&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;time&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; processStart&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;60&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Script took %s minutes to complete"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt;processEnd&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;/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;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;I've seen some other discussion here about a bug with the apply symbology from layer gp tool not working in python scripts in, but I don't think that's the case here because it is applied then reverts. I also tried a different approach for adding and symbolize the raster in case &lt;STRONG style="color: #ff0000; background-color: #ffffff; border: 0px; font-weight: bold;"&gt;BUG-000108497&lt;/STRONG&gt;&amp;nbsp;is still affecting things in version 2.4.1 which I'm running.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;lf &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;LayerFile&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Temp_Symbology&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
m&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;addLayer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lf&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"TOP"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
m&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateConnectionProperties&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Temp_Symbology&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;outCF&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result looks as follows.&amp;nbsp; When the last line of my script--the printing message with a total run time--executes the symbology from the layer has been applied.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/472753_ProScreenshot1.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Moments later, when the tool dialog prints that it has successfully completed, the symbology of the output has changed back to a stretch.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji jive-image image-2 j-img-original" src="https://community.esri.com/legacyfs/online/472760_ProScreenshot2.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:43:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-symbology-applied-with-python-script-tool/m-p/682557#M52856</guid>
      <dc:creator>JakeSlyder1</dc:creator>
      <dc:date>2021-12-12T04:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: Why does symbology applied with Python Script tool in Pro revert to default symbology when the script tool finishes?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-symbology-applied-with-python-script-tool/m-p/682558#M52857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jacob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried with the following script using ArcGIS Pro 2.4.2, and the symbology did not revert back to stretch:&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;import&lt;/SPAN&gt; time

processStart &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; time&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;time&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

outCF &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\DATA\RASTER\DEM\int_example1"&lt;/SPAN&gt;
Temp_Symbology &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\DATA\RASTER\DEM\dem_classify.lyrx"&lt;/SPAN&gt;

p &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CURRENT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
m &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; p&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;activeMap
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; m &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    lyr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; m&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;addDataFromPath&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outCF&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ApplySymbologyFromLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Temp_Symbology&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;


processEnd &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;time&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;time&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; processStart&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;60&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Script took %s minutes to complete"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt;processEnd&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;/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;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may want to try upgrade to 2.4.2 and see if the issue still occurs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:43:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-symbology-applied-with-python-script-tool/m-p/682558#M52857</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-12T04:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: Why does symbology applied with Python Script tool in Pro revert to default symbology when the script tool finishes?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-symbology-applied-with-python-script-tool/m-p/682559#M52858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Jake, thanks for the response.&amp;nbsp; Good idea to check it through the console, didn't think of that.&amp;nbsp;&amp;nbsp;Unfortunately, it doesn't appear to be a version issue.&amp;nbsp; I ran that on 2.4.1 through the console and the symbology did not revert.&amp;nbsp; So it would seem to me the issue is not with the script itself, but with the behavior of how the output is handled when the script is imported into a toolbox and run that way.&amp;nbsp; I will try it on 2.4.2 when&amp;nbsp;it is approved by our IT for installation.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2019 18:35:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-symbology-applied-with-python-script-tool/m-p/682559#M52858</guid>
      <dc:creator>JakeSlyder1</dc:creator>
      <dc:date>2019-11-07T18:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Why does symbology applied with Python Script tool in Pro revert to default symbology when the script tool finishes?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-symbology-applied-with-python-script-tool/m-p/682560#M52859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried as a Script tool as well (i.e. right-click on Toolbox &amp;gt; New &amp;gt; Script).&amp;nbsp; Note, I did not choose the option &lt;STRONG&gt;Import Script&lt;/STRONG&gt; when doing this.&amp;nbsp; Running as a Script tool was also successful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2019 18:38:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-symbology-applied-with-python-script-tool/m-p/682560#M52859</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2019-11-07T18:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Why does symbology applied with Python Script tool in Pro revert to default symbology when the script tool finishes?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-symbology-applied-with-python-script-tool/m-p/682561#M52860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jacob, of you are using a custom toolbox, you can set the output symbology in the parameter dialog, (python toolboxes, through the validation code)&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/472800_toolbox_parameters2.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2019 18:44:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-symbology-applied-with-python-script-tool/m-p/682561#M52860</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-11-07T18:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: Why does symbology applied with Python Script tool in Pro revert to default symbology when the script tool finishes?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-symbology-applied-with-python-script-tool/m-p/682562#M52861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, thank you for the helpful suggestions.&amp;nbsp;Interestingly, setting the symbology in the parameter dialog of the tool properties did not solve the problem.&amp;nbsp; However, I found that "SetParamter" was able to solve the problem.&amp;nbsp;&amp;nbsp;In the toolbox properties, the 5th parameter (so index 4) was set as a "Raster Dataset."&amp;nbsp; At the end of the script, I just added the quick line below to set this parameter equal to my "lyr" variable after the symbology was applied to "lyr."&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SetParameter&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;4&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;lyr&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:43:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-symbology-applied-with-python-script-tool/m-p/682562#M52861</guid>
      <dc:creator>JakeSlyder1</dc:creator>
      <dc:date>2021-12-12T04:43:07Z</dc:date>
    </item>
  </channel>
</rss>

