<?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 Python Add-In Extension 'enabled' / 'autoload' behaviour in Python AddIns Questions</title>
    <link>https://community.esri.com/t5/python-addins-questions/python-add-in-extension-enabled-autoload-behaviour/m-p/769430#M19</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a Python add-in that includes an extension.&amp;nbsp; The only purpose if this extension is for some buttons in the add-in to be automatically enabled/disabled depending on if there are relevant layers in the current MXD's table on contents.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Therefore I need this extension to be loaded automatically when this add-in is installed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND I need this extension to be enabled right from the start.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the config.xml, 'autoLoad' is set to 'true'.&amp;nbsp; In the Python class, the __init__ function for the extension class includes:&lt;/P&gt;&lt;P&gt;self.enabled = True&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I install the add-in and run ArcMap, the extensions dialog shows the extension but NOT checked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I have found that if I run something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;myExtension.enabled = True&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Within the __init__ method of some other toolbar class (eg, one of the buttons), then the extension IS CHECKED in the extensions dialog!&amp;nbsp; However, it doesn't actually work.&amp;nbsp; If I then quit ArcMap and restart ArcMap, the extension works fine (presumably because it remained enabled from the previous run of ArcMap).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I can get the desired behaviour&amp;nbsp;ONLY if I do BOTH of the following ODD things:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;enable the extension in the class of some other add-in button&lt;/LI&gt;&lt;LI&gt;launch, quit, launch ArcMap&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to get a Python add-in extension to automatically load and be enabled by default when the add-in is installed by any other means?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Feb 2019 01:25:27 GMT</pubDate>
    <dc:creator>TI</dc:creator>
    <dc:date>2019-02-22T01:25:27Z</dc:date>
    <item>
      <title>Python Add-In Extension 'enabled' / 'autoload' behaviour</title>
      <link>https://community.esri.com/t5/python-addins-questions/python-add-in-extension-enabled-autoload-behaviour/m-p/769430#M19</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a Python add-in that includes an extension.&amp;nbsp; The only purpose if this extension is for some buttons in the add-in to be automatically enabled/disabled depending on if there are relevant layers in the current MXD's table on contents.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Therefore I need this extension to be loaded automatically when this add-in is installed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND I need this extension to be enabled right from the start.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the config.xml, 'autoLoad' is set to 'true'.&amp;nbsp; In the Python class, the __init__ function for the extension class includes:&lt;/P&gt;&lt;P&gt;self.enabled = True&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I install the add-in and run ArcMap, the extensions dialog shows the extension but NOT checked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I have found that if I run something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;myExtension.enabled = True&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Within the __init__ method of some other toolbar class (eg, one of the buttons), then the extension IS CHECKED in the extensions dialog!&amp;nbsp; However, it doesn't actually work.&amp;nbsp; If I then quit ArcMap and restart ArcMap, the extension works fine (presumably because it remained enabled from the previous run of ArcMap).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I can get the desired behaviour&amp;nbsp;ONLY if I do BOTH of the following ODD things:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;enable the extension in the class of some other add-in button&lt;/LI&gt;&lt;LI&gt;launch, quit, launch ArcMap&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to get a Python add-in extension to automatically load and be enabled by default when the add-in is installed by any other means?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2019 01:25:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-addins-questions/python-add-in-extension-enabled-autoload-behaviour/m-p/769430#M19</guid>
      <dc:creator>TI</dc:creator>
      <dc:date>2019-02-22T01:25:27Z</dc:date>
    </item>
  </channel>
</rss>

