How to create a custom data tree?

Hi there! I am trying to create a custom data tree with one branch {0;1} and insert there a list of data. But apparently, I have written something wrong. Would you point out my mistake?

import Rhino
import Grasshopper as gh

t = ["a","b","c"]
path = gh.Kernel.Data.GH_Path(0,1)
tree = gh.DataTree 
gh.DataTree.Insert(tree,t,path,0)

You probably want the AddRange method, see an example here. Also Giulio’s link further up to the official McNeel GHPython DataTree docs:

1 Like