Remove gh component with python script

Hi every one ,

i’ve got a problems , I’m trying to remove gh component with Rhinoscript . Here is the code we tried:

if x:
    for obj in ghObjects:
        name = obj.NickName
        guid = obj.InstanceGuid
        print Name
            #gh.Kernel.GH_Document.RemoveObject(ghDoc ,obj,True)

But i think Kernel is not the good library, do you now wich library i have to use?

Thanks you very much


I have a method, but it is not perfect.,Maybe you need gh.Kernel.GH_Document.NewSolution(ghDoc,False).

I hope this help you.
this is my (7.3 KB)