actualy I know how to insert the keyframe to custom properties; that was solved in previous post
with the same idea I want to insert the keyframe to object.data.layers
I can access and modify the data layers values:
context = bpy.context
obj= context.active_object
obj.data.layers[0]
I test some ideas in order to insert the keyframe with any result:
obj.data.keyframe_insert(data_path = 'layers[\"1"\]')
obj.data.keyframe_insert(data_path = layers[str(1)]))
obj.data.keyframe_insert(data_path = '"layers[1]"')
obj.data.keyframe_insert(data_path = 'layers[1]')
obj.data.keyframe_insert(data_path = layers[1])
at this point I think in the wrong place
some ideas please
****************************** update 1***********
I have this layers as buttons in a addon UI



C.object.data.keyframe_insert('layers', frame=20, index=2)Really the same as key-framing a single location axis. – batFINGER Sep 03 '20 at 16:03