<?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: Launch python toolbox from toolbar: can it be done? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/launch-python-toolbox-from-toolbar-can-it-be-done/m-p/670620#M51957</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You need to call the class name for a .pyt.&amp;nbsp; So I have a python tool called 'Tool', so I pass in Tool to the name parameter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; relPath = os.path.dirname(__file__)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pyt = relPath + os.sep + "customToolbox.pyt"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pythonaddins.GPToolDialog(pyt, "Tool") # Tool is the class name 
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, ensure that the .pyt is in the add-in file.&amp;nbsp; You can check that by renaming the extension .zip and examining the contents.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//014p00000021000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//014p00000021000000&lt;/A&gt;&lt;SPAN&gt; for more information.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 04:18:34 GMT</pubDate>
    <dc:creator>AndrewChapkowski</dc:creator>
    <dc:date>2021-12-12T04:18:34Z</dc:date>
    <item>
      <title>Launch python toolbox from toolbar: can it be done?</title>
      <link>https://community.esri.com/t5/python-questions/launch-python-toolbox-from-toolbar-can-it-be-done/m-p/670619#M51956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I need to put a button on a toolbar to launch my new python toolbox tool that maps condos. I have found this to be impossible, and am hoping for help...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried building an add-in to launch the pyt, but in testing it I get a pop-up error "Failed to open toolbox Condos.pyt". Perhaps this means add-ins simply do not support python toolboxes, or maybe I've incorrectly specified the path in the add-in's onClick def: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;toolboxPath = os.path.join(os.path.dirname(__file__), toolboxName + ".pyt")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The reason I'm uncertain about the path is that the pyt is in "My Toolboxes", and I don't know whether this code actually points there (I'm very new to python). Or maybe a pyt is merely incompatible here, because the example code has ".tbx" in the above line. Any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To re-write my pyt as a regular python script in a tbx and set up params that way has certainly occurred to me and would probably work, but would be a huge disappointment given the time invested in the pyt that works so nicely. How can I launch from a toolbar button the CondoBuilderTool of Condos.pyt? Is that even possible? Please help me with some suggestions here. How can I resolve this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Justin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2012 14:18:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/launch-python-toolbox-from-toolbar-can-it-be-done/m-p/670619#M51956</guid>
      <dc:creator>deleted-user-zpcJw1u0IXiO</dc:creator>
      <dc:date>2012-10-17T14:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: Launch python toolbox from toolbar: can it be done?</title>
      <link>https://community.esri.com/t5/python-questions/launch-python-toolbox-from-toolbar-can-it-be-done/m-p/670620#M51957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You need to call the class name for a .pyt.&amp;nbsp; So I have a python tool called 'Tool', so I pass in Tool to the name parameter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; relPath = os.path.dirname(__file__)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pyt = relPath + os.sep + "customToolbox.pyt"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pythonaddins.GPToolDialog(pyt, "Tool") # Tool is the class name 
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, ensure that the .pyt is in the add-in file.&amp;nbsp; You can check that by renaming the extension .zip and examining the contents.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//014p00000021000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//014p00000021000000&lt;/A&gt;&lt;SPAN&gt; for more information.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:18:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/launch-python-toolbox-from-toolbar-can-it-be-done/m-p/670620#M51957</guid>
      <dc:creator>AndrewChapkowski</dc:creator>
      <dc:date>2021-12-12T04:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: Launch python toolbox from toolbar: can it be done?</title>
      <link>https://community.esri.com/t5/python-questions/launch-python-toolbox-from-toolbar-can-it-be-done/m-p/670621#M51958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Also, ensure that the .pyt is in the add-in file.&amp;nbsp; You can check that by renaming the extension .zip and examining the contents.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you Andrew. I have updated Tools_addin.py as you instructed, as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; def onClick(self):

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # name of toolbox
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; toolboxName = "Condos"

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # name of tool to be executed (the class in Condos.pyt) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; toolName = "CondoTool"

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # create string with path to toolbox
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; relPath = os.path.dirname(__file__)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pyt = relPath + os.sep + toolboxName + ".pyt"

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # call geoprocessing tool
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pythonaddins.GPToolDialog(pyt, toolName)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, I did check the add-in file and did NOT find the .pyt anywhere inside. The file contains two subfolders, so can I just insert the .pyt to the file as I would into a zip? If no, please explain the proper method. If yes, should the Install subfolder be the destination? Further, what more should I do to ensure the .pyt is included when I share the add-in (I feel I'm updating here the installed add-in, not the actual installer--please correct me if I'm wrong).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:18:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/launch-python-toolbox-from-toolbar-can-it-be-done/m-p/670621#M51958</guid>
      <dc:creator>deleted-user-zpcJw1u0IXiO</dc:creator>
      <dc:date>2021-12-12T04:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: Launch python toolbox from toolbar: can it be done?</title>
      <link>https://community.esri.com/t5/python-questions/launch-python-toolbox-from-toolbar-can-it-be-done/m-p/670622#M51959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The .pyt files need to be placed in the install folder of the python add-in, and the makeaddin.py file needs to be re-run.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After that, you can then re-install the add-in by double clicking on the file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, ensure that you close and restart arcmap or catalog.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Andrew&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2012 16:38:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/launch-python-toolbox-from-toolbar-can-it-be-done/m-p/670622#M51959</guid>
      <dc:creator>AndrewChapkowski</dc:creator>
      <dc:date>2012-10-17T16:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: Launch python toolbox from toolbar: can it be done?</title>
      <link>https://community.esri.com/t5/python-questions/launch-python-toolbox-from-toolbar-can-it-be-done/m-p/670623#M51960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Works like a charm now. I've learned a lot today :D. Thanks so much, Andrew!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2012 18:35:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/launch-python-toolbox-from-toolbar-can-it-be-done/m-p/670623#M51960</guid>
      <dc:creator>deleted-user-zpcJw1u0IXiO</dc:creator>
      <dc:date>2012-10-17T18:35:36Z</dc:date>
    </item>
  </channel>
</rss>

