How to add folder in scene?

The folders have a special folder display node, but it is only created when you show/hide it in the Data module (you’ll notice because the color item will appear in its row). In theory you can create it programmatically, but as I see that function is not python wrapped. This is the code:

pluginHandlerSingleton = slicer.qSlicerSubjectHierarchyPluginHandler.instance()
folderPlugin = pluginHandlerSingleton.pluginByName('Folder')
folderPlugin.createDisplayNodeForItem(folderItemID)

If you need to create the display node programmatically, there are two ways:

  1. Do in Python what this createDisplayNodeForItem function does
  2. Fix Python wrapping of the function