<?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: Can tools from imported scripts in a Python Toolbox be placed into Toolsets? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/can-tools-from-imported-scripts-in-a-python/m-p/1330330#M68689</link>
    <description>&lt;P&gt;Thanks Hayden, I tried your suggestion however I still see that the toolbox is 'broken' and when checking the syntax I get an error.&lt;/P&gt;&lt;P class="lia-align-center"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="error1.JPG" style="width: 200px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/81138i410DE7BDDA7B6915/image-size/small?v=v2&amp;amp;px=200" role="button" title="error1.JPG" alt="error1.JPG" /&gt;&lt;/span&gt;&lt;BR /&gt;Figure 1. Broken toolbox.&lt;/P&gt;&lt;P class="lia-align-center"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="syntaxerror.jpg" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/81139i22EA6F95FD4D72F6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="syntaxerror.jpg" alt="syntaxerror.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P class="lia-align-center"&gt;&amp;nbsp;Figure 2. Syntax Error.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I also tried the renaming the folders to atools and btools and trying a different way to import however I was met with no luck:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
import os
import sys
myScripts = os.path.join(os.path.dirname(__file__), "scripts","atools")
sys.path.append(myScripts)
import scripts.atools.First.FirstTool as First

myScripts = os.path.join(os.path.dirname(__file__), "scripts","btools")
sys.path.append(myScripts)
import scripts.btools.Second.SecondTool as Second
import scripts.btools.Third.ThirdTool as Third

class Toolbox(object):
    def __init__(self):
        self.label = u'Example_Toolbox'
        self.alias = ''
        self.tools = [First, Second, Third]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Sep 2023 18:47:08 GMT</pubDate>
    <dc:creator>ColinLindeman</dc:creator>
    <dc:date>2023-09-19T18:47:08Z</dc:date>
    <item>
      <title>Can tools from imported scripts in a Python Toolbox be placed into Toolsets?</title>
      <link>https://community.esri.com/t5/python-questions/can-tools-from-imported-scripts-in-a-python/m-p/1329927#M68677</link>
      <description>&lt;P&gt;Hello, I'd like to create a python toolbox for ArcPro that imports all of its tools from scripts in separate folders and I want these tools placed in toolsets. I may even put toolsets within toolsets. This way I can manage the python code more easily and avoid having all of it in one python script.&lt;/P&gt;&lt;P&gt;It appears that when a tool is imported as a script from another directory, the tool's self.category field is not honored and the tool is placed at the toolbox root. Any ideas on how to implement this? Did I do something incorrectly or will I need to request help/fix from ESRI?&lt;/P&gt;&lt;P class="lia-align-center"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="This is the desired outcome when viewd in ArcGIS Pro. This setup does not import the script files but contains all tools within one python file." style="width: 215px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/81012i0C0F1357A072C3F2/image-size/large?v=v2&amp;amp;px=999" role="button" title="desired_toolbox.JPG" alt="This is the desired outcome when viewd in ArcGIS Pro. This setup does not import the script files but contains all tools within one python file." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;This is the desired outcome when viewd in ArcGIS Pro. This setup does not import the script files but contains all tools within one python file.&lt;/span&gt;&lt;/span&gt;Figure 1. Desired outcome.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="This screenshot shows what happens when the tools are imported. The self.category settings appear to be ignored." style="width: 234px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/81013iB363BEF1CF3BDF40/image-size/large?v=v2&amp;amp;px=999" role="button" title="actual.JPG" alt="This screenshot shows what happens when the tools are imported. The self.category settings appear to be ignored." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;This screenshot shows what happens when the tools are imported. The self.category settings appear to be ignored.&lt;/span&gt;&lt;/span&gt;Figure 2. Actual outcome.&lt;/P&gt;&lt;P&gt;Here is&amp;nbsp; the code to reproduce the issue as seen in Figure 2. You will need to setup the folder structure as needed (see screenshots above).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
import os
import sys
myScripts = os.path.join(os.path.dirname(__file__), "scripts","Import")
sys.path.append(myScripts)
from scripts.Import import First

myScripts = os.path.join(os.path.dirname(__file__), "scripts","Export")
sys.path.append(myScripts)
from scripts.Export import Second
from scripts.Export import Third

class Toolbox(object):
    def __init__(self):
        self.label = u'Example_Toolbox'
        self.alias = ''
        self.tools = [First, Second, Third]
&lt;/LI-CODE&gt;&lt;LI-CODE lang="python"&gt;class FirstTool(object):

    def __init__(self):
        self.label = u'First Tool'
        self.description = u''
        self.canRunInBackground = False
        self.category = "Import"

    def getParameterInfo(self):
        return

    def execute(self, parameters, messages):
        pass&lt;/LI-CODE&gt;&lt;LI-CODE lang="python"&gt;class SecondTool(object):

    def __init__(self):
        self.label = u'Second Tool'
        self.description = u''
        self.canRunInBackground = False
        self.category = "Export"

    def getParameterInfo(self):
        return

    def execute(self, parameters, messages):
        pass&lt;/LI-CODE&gt;&lt;LI-CODE lang="python"&gt;class ThirdTool(object):

    def __init__(self):
        self.label = u'Third Tool'
        self.description = u''
        self.canRunInBackground = False
        self.category = "Export"

    def getParameterInfo(self):
        return

    def execute(self, parameters, messages):
        pass&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This post was helpful in setting toolsets (self.category) &lt;A href="https://community.esri.com/t5/python-questions/python-toolbox-toolset/m-p/636796/thread-id/49579" target="_blank"&gt;https://community.esri.com/t5/python-questions/python-toolbox-toolset/m-p/636796/thread-id/49579&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This post was helpful in importing scripts from other folders &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/share-analysis/packaging-python-scripts.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/share-analysis/packaging-python-scripts.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 23:18:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-tools-from-imported-scripts-in-a-python/m-p/1329927#M68677</guid>
      <dc:creator>ColinLindeman</dc:creator>
      <dc:date>2023-09-18T23:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: Can tools from imported scripts in a Python Toolbox be placed into Toolsets?</title>
      <link>https://community.esri.com/t5/python-questions/can-tools-from-imported-scripts-in-a-python/m-p/1330027#M68678</link>
      <description>&lt;P&gt;Welcome to the community, ColinLindeman!&lt;/P&gt;&lt;P&gt;Thank you for sharing your question about importing tools from scripts in a Python Toolbox. I understand that you're facing challenges w&lt;A href="https://apksoldier.com/monopoly-go-mod-apk/" target="_self"&gt;i&lt;/A&gt;th tool placement when using separate folders and toolsets.&lt;/P&gt;&lt;P&gt;Based on the information and code you provided, it seems that the self.category settings are not being honored when importing the tools as scripts. To resolve this issue, I recommend reaching out to the ESRI support team or posting your question in the Python Questions section of the community.&lt;/P&gt;&lt;P&gt;Other community members may also offer their experiences and suggestions to help you find a solution. Feel free to provide any additional details or ask for further clarification.&lt;/P&gt;&lt;P&gt;We're glad to have you here, and we look forward to assisting you further!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 08:57:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-tools-from-imported-scripts-in-a-python/m-p/1330027#M68678</guid>
      <dc:creator>JonSnow06</dc:creator>
      <dc:date>2023-09-19T08:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Can tools from imported scripts in a Python Toolbox be placed into Toolsets?</title>
      <link>https://community.esri.com/t5/python-questions/can-tools-from-imported-scripts-in-a-python/m-p/1330148#M68681</link>
      <description>&lt;P data-unlink="true"&gt;You need to import the tool objects, but currently you're importing the module:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
import os
import sys
myScripts = os.path.join(os.path.dirname(__file__), "scripts","Import")
sys.path.append(myScripts)
from scripts.Import import First.FirstTool as First

myScripts = os.path.join(os.path.dirname(__file__), "scripts","Export")
sys.path.append(myScripts)
from scripts.Export import Second.SecondTool as Second
from scripts.Export import Third.ThirdTool as Third

class Toolbox(object):
    def __init__(self):
        self.label = u'Example_Toolbox'
        self.alias = ''
        self.tools = [First, Second, Third]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-ideas/python-tool-management-system/idi-p/1327512" target="_self"&gt;If you want more info on this, I have a recent post here about managed toolboxes that use python's module structure&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 14:24:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-tools-from-imported-scripts-in-a-python/m-p/1330148#M68681</guid>
      <dc:creator>HaydenWelch</dc:creator>
      <dc:date>2023-09-19T14:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Can tools from imported scripts in a Python Toolbox be placed into Toolsets?</title>
      <link>https://community.esri.com/t5/python-questions/can-tools-from-imported-scripts-in-a-python/m-p/1330330#M68689</link>
      <description>&lt;P&gt;Thanks Hayden, I tried your suggestion however I still see that the toolbox is 'broken' and when checking the syntax I get an error.&lt;/P&gt;&lt;P class="lia-align-center"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="error1.JPG" style="width: 200px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/81138i410DE7BDDA7B6915/image-size/small?v=v2&amp;amp;px=200" role="button" title="error1.JPG" alt="error1.JPG" /&gt;&lt;/span&gt;&lt;BR /&gt;Figure 1. Broken toolbox.&lt;/P&gt;&lt;P class="lia-align-center"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="syntaxerror.jpg" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/81139i22EA6F95FD4D72F6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="syntaxerror.jpg" alt="syntaxerror.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P class="lia-align-center"&gt;&amp;nbsp;Figure 2. Syntax Error.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I also tried the renaming the folders to atools and btools and trying a different way to import however I was met with no luck:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
import os
import sys
myScripts = os.path.join(os.path.dirname(__file__), "scripts","atools")
sys.path.append(myScripts)
import scripts.atools.First.FirstTool as First

myScripts = os.path.join(os.path.dirname(__file__), "scripts","btools")
sys.path.append(myScripts)
import scripts.btools.Second.SecondTool as Second
import scripts.btools.Third.ThirdTool as Third

class Toolbox(object):
    def __init__(self):
        self.label = u'Example_Toolbox'
        self.alias = ''
        self.tools = [First, Second, Third]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 18:47:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-tools-from-imported-scripts-in-a-python/m-p/1330330#M68689</guid>
      <dc:creator>ColinLindeman</dc:creator>
      <dc:date>2023-09-19T18:47:08Z</dc:date>
    </item>
  </channel>
</rss>

