Using bpy, how do I remove an object from a collection without also removing it from other places?
I have an object that is both part of a collection and at the same time a child of another object. I try to unlink it from the collection:
collection.objects.unlink(obj)
But it also disappears from the other object.
Even in the GUI I can't seem to remove it from only one place in the outliner. How do I do this right?
EDIT: The reason why I got here: I have this structure:
- Collection1
- Collection2
- Object1
- ObjectToBeMoved
- Object3
I want to move Object2 from Object1 to Object3. So I do:
ObjectToBeMoved.parent = Object3
I end up with this:
- Collection1
- Collection2
- ObjectToBeMoved
- Object1
- Object3
- ObjectToBeMoved
It gets the new parent (Object3) but it also moves up in the hierarchy to become sibling with its former parent, under Collection2. That's why I want to delete it from Collection2. But when I do that it also disappears from Object3.
Is there another, better, way to move an object?
ObjectToBeMoved
toCollection1
somewhere? I can't see that step in your description. Keep in mind that parenting does not move the object to the other collection, it only sets the parent. $\endgroup$