I have created a Python toolbox and a simple SimpleTool with this initialization:

class SimpleTool(object):
    def __init__(self):
        self.label = "Simple label"
        self.description = "Simple description"
        self.category = "Group1"

It is working like expected - the toolbox puts the tool into the Group1 category. Now I would like to create a sub-group under this Group1 called e.g. Sub-group1.

If you create an ordinary toolbox under MyToolboxes, you can create unlimited(?) new sub-groups in sub-groups in sub-groups in that toolbox. But I can see no way how to do it within Python Toolbox.

Is it possible to create sub-groups under a group in Python Toolbox?


I have not tested this, although I think I have done this in the past, but I found some code that describes it in a GeoNet thread called Python Toolbox Toolset.

The key thing is to:

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)

As the asker commented:

It really works, so the solution is:

self.category = "Group1\\Sub-group1"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.