rs.addGroup throwing Runtime error

I wrote a small script to create a group in Grasshopper using rhinoscript and got this error. Why is this happening? Here´s the error text:

“Runtime error (NotSupportedException): This type of object is not supported in Grasshopper, so this Python script cannot create it. You might want to use ‘scriptcontext.doc = Rhino.RhinoDoc.ActiveDoc’ to use the Rhino doc, instead? If you do, remember to restore it: ‘scriptcontext.doc = ghdoc’.”

Hey @pmora1990

The short answer is because groups are not supported in grasshopper. The error message has some useful hints as to how to achieve your goal. Have a look at this blog post to learn more about scriptcontext and how to use it to create things in rhino that grasshopper does not support: