How to keyframe the volume of a speaker with python one can set the keyframe of an objects location with:
bpy.context.object.keyframe_insert(data_path=&quot;location&quot;, frame=1)

and it will set the keyframe of the location.
Right now I'm trying to add a keyframe to a newly added speaker that I created with python:
NewSpeaker = bpy.ops.object.speaker_add(location=(0,0,0))

following that I change the speakers volume:
bpy.context.object.data.volume = 0.6

this does work propperly and with no issue, so when trying to keyframe the volume like this:
bpy.context.object.keyframe_insert(data_path=&quot;volume&quot;, frame=1)

I receive the following error message:
TypeError: bpy_struct.keyframe() property &quot;volume&quot; not found

It does work with things such as location or rotation_euler, but nothing in the Object Data Properties.
Things such volume min are not able to have keyframes, but volume and pitch are able to be keyframed.
Is there a way to keyframe the volume with python?
Volume is a data property, not an object property.
Don't use:
obj.keyframe_insert(&quot;volume&quot;)

But use:
obj.data.keyframe_insert(&quot;volume&quot;)