I have a script that creates a group hierarchy. In this hierarchy it is necessary to decompose links. All I managed to do was find this command: obj = bpy.context.active_object
bpy.data.collections['tube'].objects.link(obj)
it makes the object dependent on the collection but does not completely transfer my object.
bpy.data.collections['space'].objects.unlink(obj)
$\endgroup$