Remove object from specific group programmatically Somehow I have managed to add objects to a group called "myGroup" without actually wanting to do that. I now want to remove all those objects from that group, which at the same time were already assigned to another group. I figured the best way would be to do that in python. I tried the following:

allObjects = bpy.data.objects;
for obj in allObjects:
    count = 0;
    found = 0;
    for gr in obj.users_group:
        count = count + 1;
        if gr.name == 'myGroup'
            found = 1;
    if count &gt; 1 and found == 1
        for object in bpy.context.visible_objects:
            object.select = False;
        obj.select = True;
        REMOVE obj from group myGroup!!!!


I do not know how to put the last line into valid python code. I know that there is a function could "bpy.ops.object.group_remove()", but I do not understand which group the object is deleted from when I call this function.
Any help? :)
If you don't mind not using python, you can just select the objects and press &#9096; Ctrl&#9095; AltG, then select the group you want to remove them from:





If you still want to use python, then you want a group operator, rather than a object operator:

bpy.ops.group.objects_remove(group="myGroup")


This will remove the selected objects from the group "myGroup".