Unique and invariable ID (within the session) for an object?
Use a pointer property
Can set up a pointer to any blender ID type objects, in this case bpy.types.Object instances of which can be found in bpy.data.objects collection.
Assign the property to class
import bpy
from bpy.types import Object, Scene
from bpy.props import PointerProperty


Scene.target_obj = PointerProperty(type=Object)

Test.
&gt;&gt;&gt; C.object
bpy.data.objects['Cube']

&gt;&gt;&gt; bpy.ops.object.duplicate()
{'FINISHED'}

&gt;&gt;&gt; C.object
bpy.data.objects['Cube.001']

&gt;&gt;&gt; C.scene.target_obj = C.object
&gt;&gt;&gt; C.object.name = &quot;Foo&quot;
&gt;&gt;&gt; C.scene.target_obj
bpy.data.objects['Foo']