<?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 Script works in python window but not as a tool. in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/script-works-in-python-window-but-not-as-a-tool/m-p/1161157#M26262</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to run a super simple script to change the band setup of all TIFs loaded in my map.&amp;nbsp; Runs fine if I paste the code in the python window, but when I add the script to a toolbox and run it, it looks like it's working...I see a lock icon appear next to each TIF, but when it unlocks nothing has updated and it says the geoprocessing tool has successfully run.&lt;/P&gt;&lt;P&gt;Also, is there a way programmatically in python to change just the band setup without having to apply a layer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;p = arcpy.mp.ArcGISProject('CURRENT')&lt;BR /&gt;m = p.listMaps('Map')[0]&lt;BR /&gt;tifs = m.listLayers('*.tif')&lt;BR /&gt;sourceLayer = 'C:/source.lyrx'&lt;BR /&gt;for tif in tifs:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ApplySymbologyFromLayer_management(tif,sourceLayer)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thanks for any help!&lt;/P&gt;</description>
    <pubDate>Tue, 05 Apr 2022 14:49:18 GMT</pubDate>
    <dc:creator>SeanConway2</dc:creator>
    <dc:date>2022-04-05T14:49:18Z</dc:date>
    <item>
      <title>Script works in python window but not as a tool.</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/script-works-in-python-window-but-not-as-a-tool/m-p/1161157#M26262</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to run a super simple script to change the band setup of all TIFs loaded in my map.&amp;nbsp; Runs fine if I paste the code in the python window, but when I add the script to a toolbox and run it, it looks like it's working...I see a lock icon appear next to each TIF, but when it unlocks nothing has updated and it says the geoprocessing tool has successfully run.&lt;/P&gt;&lt;P&gt;Also, is there a way programmatically in python to change just the band setup without having to apply a layer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;p = arcpy.mp.ArcGISProject('CURRENT')&lt;BR /&gt;m = p.listMaps('Map')[0]&lt;BR /&gt;tifs = m.listLayers('*.tif')&lt;BR /&gt;sourceLayer = 'C:/source.lyrx'&lt;BR /&gt;for tif in tifs:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ApplySymbologyFromLayer_management(tif,sourceLayer)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thanks for any help!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 14:49:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/script-works-in-python-window-but-not-as-a-tool/m-p/1161157#M26262</guid>
      <dc:creator>SeanConway2</dc:creator>
      <dc:date>2022-04-05T14:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Script works in python window but not as a tool.</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/script-works-in-python-window-but-not-as-a-tool/m-p/1161168#M26263</link>
      <description>&lt;P&gt;Hello Sean,&lt;/P&gt;&lt;P&gt;Instead of running the geoprocessing tool against your project, I would point to the actual TIFs and then close the project.&amp;nbsp; They may be getting locked and unable to update due to being accessed in your project.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 15:10:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/script-works-in-python-window-but-not-as-a-tool/m-p/1161168#M26263</guid>
      <dc:creator>ABishop</dc:creator>
      <dc:date>2022-04-05T15:10:42Z</dc:date>
    </item>
  </channel>
</rss>

