<?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>idea layer list updates with changes in TOC using arcpy in Python Ideas</title>
    <link>https://community.esri.com/t5/python-ideas/layer-list-updates-with-changes-in-toc-using-arcpy/idi-p/1014708</link>
    <description>&lt;P&gt;when using the python interpreter window within ArcGIS Desktop, the layer list does not update if the table of contents changes.&amp;nbsp; For example, in my .mxd I have three layers - but when I'm writing a command, for example arcpy.MakeFeaureLayer_management, the auto-populated layer list does not reflect the layers that are currently in the table of contents.&amp;nbsp; See image for example.&amp;nbsp; Is this a bug or what?&amp;nbsp; If it's a bug, it should be fixed.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jan 2021 16:49:37 GMT</pubDate>
    <dc:creator>Ann123</dc:creator>
    <dc:date>2021-01-07T16:49:37Z</dc:date>
    <item>
      <title>layer list updates with changes in TOC using arcpy</title>
      <link>https://community.esri.com/t5/python-ideas/layer-list-updates-with-changes-in-toc-using-arcpy/idi-p/1014708</link>
      <description>&lt;P&gt;when using the python interpreter window within ArcGIS Desktop, the layer list does not update if the table of contents changes.&amp;nbsp; For example, in my .mxd I have three layers - but when I'm writing a command, for example arcpy.MakeFeaureLayer_management, the auto-populated layer list does not reflect the layers that are currently in the table of contents.&amp;nbsp; See image for example.&amp;nbsp; Is this a bug or what?&amp;nbsp; If it's a bug, it should be fixed.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 16:49:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/layer-list-updates-with-changes-in-toc-using-arcpy/idi-p/1014708</guid>
      <dc:creator>Ann123</dc:creator>
      <dc:date>2021-01-07T16:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: layer list updates with changes in TOC using arcpy</title>
      <link>https://community.esri.com/t5/python-ideas/layer-list-updates-with-changes-in-toc-using-arcpy/idc-p/1014716#M14</link>
      <description>&lt;P&gt;Looking at the screenshot, I see two of the layers listed, and I suspect the third is listed if you scroll down.&amp;nbsp; The real issue is that the list is cluttered up with old layers that are no longer in the TOC.&amp;nbsp; Have you run any script tools?&amp;nbsp; This can happen when script tools create layers and don't clean them up correctly.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 17:05:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/layer-list-updates-with-changes-in-toc-using-arcpy/idc-p/1014716#M14</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-01-07T17:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: layer list updates with changes in TOC using arcpy</title>
      <link>https://community.esri.com/t5/python-ideas/layer-list-updates-with-changes-in-toc-using-arcpy/idc-p/1014890#M15</link>
      <description>&lt;P&gt;I see the same behavior in ArcMap 10.8.1&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KoryKramer_0-1610057172411.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/3418i8927873CD69452D1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KoryKramer_0-1610057172411.png" alt="KoryKramer_0-1610057172411.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I haven't been able to figure out a way to clear/flush the Python window's cache (if that is the correct term).&lt;/P&gt;&lt;P&gt;For what it's worth, when I try this in ArcGIS Pro, adding layers to a map is picked up in the Python window right away:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KoryKramer_1-1610057342700.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/3419iC4FB24AE350FBCA5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KoryKramer_1-1610057342700.png" alt="KoryKramer_1-1610057342700.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If I then remove a bunch of those layers, the Python window will still show them in the layer list (like ArcMap) BUT I can refresh the map and then the Python window's layer list reflects the current layers in the Contents pane.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KoryKramer_2-1610057451105.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/3420i01FC11AC2F560B63/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KoryKramer_2-1610057451105.png" alt="KoryKramer_2-1610057451105.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So it may be a bug in ArcMap, but it looks like refreshing the map works in ArcGIS Pro.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 22:12:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/layer-list-updates-with-changes-in-toc-using-arcpy/idc-p/1014890#M15</guid>
      <dc:creator>KoryKramer</dc:creator>
      <dc:date>2021-01-07T22:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: layer list updates with changes in TOC using arcpy</title>
      <link>https://community.esri.com/t5/python-ideas/layer-list-updates-with-changes-in-toc-using-arcpy/idc-p/1015030#M16</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1371"&gt;@JoshuaBixby&lt;/a&gt;&amp;nbsp;- yes, that is exactly the problem.&amp;nbsp; The layer list is not refreshed in the python window as content is removed from the TOC layer list.&amp;nbsp; &amp;nbsp; And yes&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/129401"&gt;@KoryKramer&lt;/a&gt;&amp;nbsp;I have tried refreshing ArcMap as well as resaving and save as after removing layers - but the window clutter is still there.&amp;nbsp; The good part is that the *new* layers do show up - so this is more an annoyance, an unexpected and unanticipated behavior.&amp;nbsp; There needs to be a way to flush the window or clear the python cache, as you say, in ArcGIS Desktop.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Glad to hear that it appears to be corrected in Pro.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2021 14:59:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/layer-list-updates-with-changes-in-toc-using-arcpy/idc-p/1015030#M16</guid>
      <dc:creator>Ann123</dc:creator>
      <dc:date>2021-01-08T14:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: layer list updates with changes in TOC using arcpy</title>
      <link>https://community.esri.com/t5/python-ideas/layer-list-updates-with-changes-in-toc-using-arcpy/idc-p/1045945#M39</link>
      <description>&lt;P&gt;Interesting problem, exists in 10.6 too but I have found away to refresh that list. It's not perfect but it worked for me.&lt;/P&gt;&lt;P&gt;Remove the layer from the TOC, then in the python command line window you need to type:&lt;/P&gt;&lt;P&gt;arcpy.Exists("xxx") where xxx was the layer name. It will return FALSE as expected but it will also update the list and remove the missing layer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 15:11:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/layer-list-updates-with-changes-in-toc-using-arcpy/idc-p/1045945#M39</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2021-04-12T15:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: layer list updates with changes in TOC using arcpy - Status changed to: Closed</title>
      <link>https://community.esri.com/t5/python-ideas/layer-list-updates-with-changes-in-toc-using-arcpy/idc-p/1201916#M136</link>
      <description>&lt;P&gt;In reviewing ideas for consideration we came across this one again. There will be no changes made to ArcMap and since refresh is working in ArcGIS Pro, we're closing the idea.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 15:07:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/layer-list-updates-with-changes-in-toc-using-arcpy/idc-p/1201916#M136</guid>
      <dc:creator>KoryKramer</dc:creator>
      <dc:date>2022-08-11T15:07:36Z</dc:date>
    </item>
  </channel>
</rss>

