Solved! Go to Solution.
import arcpy class Toolbox(object): def __init__(self): self.label = u'Example_Toolbox' self.alias = '' self.tools = [FirstTool, SecondTool, ThirdTool] 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 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 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
import arcpy class Toolbox(object): def __init__(self): self.label = u'Example_Toolbox' self.alias = '' self.tools = [FirstTool, SecondTool, ThirdTool] 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 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 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
How to create toolset in toolset? It is possibile?
Sure, just embed '\' separators between the toolsets. Here's an example where the two "Export" tools will be in separate toolsets, nested underneath the parent (also on GitHub😞
import arcpy class Toolbox(object): def __init__(self): self.label = u'Example_Toolbox' self.alias = '' self.tools = [FirstTool, SecondTool, ThirdTool] 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 class SecondTool(object): def __init__(self): self.label = u'Second Tool' self.description = u'' self.canRunInBackground = False self.category = "Export\\GeoJSON" def getParameterInfo(self): return def execute(self, parameters, messages): pass class ThirdTool(object): def __init__(self): self.label = u'Third Tool' self.description = u'' self.canRunInBackground = False self.category = "Export\\TopoJSON" def getParameterInfo(self): return def execute(self, parameters, messages): pass
I've create an example, example-toolbox.pyt that hopefully clarifies (also as a Github Gist😞
You'll then have two categories within your toolbox: Export and Import, Import will contain one item and Export will contain two.
cheers,
Shaun