How to add nodes to existing group ?

Hi,

I’m writing a plugin that creates a group of nodes. But due to the number of nodes to create (around 100 000) and in order to avoid OutOfMemory errors, I need to do it in batch of 1000.

I currently create a group this way:

  var myGroupNode = figma.group(myInstanceNodes, figma.currentPage)
  myGroupNode.name = "Plugin created group "
  myGroupNode.locked = true

But I can’t find a way to add new nodes inside the group after it’s creation, so I end up with 100 groups of 1000 nodes instead of a single group of 100 000 nodes.

How can I achive this ?