<?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 Importing and running GP service works in Python window and Notebook but not Toolboxes? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/importing-and-running-gp-service-works-in-python/m-p/1599014#M73953</link>
    <description>&lt;P&gt;Pro 3.3&lt;/P&gt;&lt;P&gt;I have a GP service that I'm trying to run from a toolbox.&lt;/P&gt;&lt;P&gt;The specific tool takes a layer object as its only input parameter.&lt;/P&gt;&lt;P&gt;I can run the following code just fine in the Python Window and in a Notebook, and it works great.&lt;/P&gt;&lt;P&gt;However, in a tool (ATBX, PYT), the code just skips past that line-- the entire thing takes like 2 seconds with no output instead of the 30+ it takes in a Notebook.&lt;/P&gt;&lt;P&gt;I can tell that it's feeding in correctly, since if I, for example, feed it a list instead of a layer, it throws an error because the parameter type is wrong.&lt;/P&gt;&lt;P&gt;Here is the code that I am using.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.ImportToolbox(r"toolboxURL;toolboxFolder")
aprx = arcpy.mp.ArcGISProject("CURRENT")
mp = aprx.activeMap
lay = mp.listLayers()[0]
arcpy.ToolBoxAlias.Tool(lay)&lt;/LI-CODE&gt;&lt;P&gt;Does anyone have any idea of what's going on and how to fix this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Mar 2025 15:11:19 GMT</pubDate>
    <dc:creator>AlfredBaldenweck</dc:creator>
    <dc:date>2025-03-25T15:11:19Z</dc:date>
    <item>
      <title>Importing and running GP service works in Python window and Notebook but not Toolboxes?</title>
      <link>https://community.esri.com/t5/python-questions/importing-and-running-gp-service-works-in-python/m-p/1599014#M73953</link>
      <description>&lt;P&gt;Pro 3.3&lt;/P&gt;&lt;P&gt;I have a GP service that I'm trying to run from a toolbox.&lt;/P&gt;&lt;P&gt;The specific tool takes a layer object as its only input parameter.&lt;/P&gt;&lt;P&gt;I can run the following code just fine in the Python Window and in a Notebook, and it works great.&lt;/P&gt;&lt;P&gt;However, in a tool (ATBX, PYT), the code just skips past that line-- the entire thing takes like 2 seconds with no output instead of the 30+ it takes in a Notebook.&lt;/P&gt;&lt;P&gt;I can tell that it's feeding in correctly, since if I, for example, feed it a list instead of a layer, it throws an error because the parameter type is wrong.&lt;/P&gt;&lt;P&gt;Here is the code that I am using.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.ImportToolbox(r"toolboxURL;toolboxFolder")
aprx = arcpy.mp.ArcGISProject("CURRENT")
mp = aprx.activeMap
lay = mp.listLayers()[0]
arcpy.ToolBoxAlias.Tool(lay)&lt;/LI-CODE&gt;&lt;P&gt;Does anyone have any idea of what's going on and how to fix this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 15:11:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/importing-and-running-gp-service-works-in-python/m-p/1599014#M73953</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2025-03-25T15:11:19Z</dc:date>
    </item>
  </channel>
</rss>

