i think i know the reason for the error, when the object is on an inactive layer.
i want to copy/duplicate an object and for this i select it with python
after i selected it, i duplicate it and the next step is to get the last added object (i check the selected object then, because the last added gets selected when i duplicated it.
piece of code:
bpy.ops.object.select_all(action=‘DESELECT’) (deselect all)
copy_object.select = True (select the object i want to copy)
bpy.ops.object.duplicate()
i tested it, but i don’t know if i can copy an object without selecting it before and for me duplicating does not work when the object is not on the active layer
my (dirty) solution was to move the object to copy on an active layer and then move back to the first one. there is only the problem when in local view, i have to put them into the local view-mode too.