Hi
Why can’t we say something like this?
a.location[0].x = a.location.x + 1
Why call it all the time?
bpy.context.scene.frame_set
Below is a fully working code. I attach it to you as an example, so that you can understand why it works so slowly.
If you change 100 keys this will work for about 4 seconds.
Why can’t you just change the key by index?
For example like this
a.location[0].x += 0.01
//----------------------------------------------------------------------------
import bpy
import math
A = [1,2,3,4,5,6,89,766]
size = len(A)-1
i = 0
key = 0
name_ = “Cube.001”
a = bpy.data.objects[name_]
while i <= size:
key = A[i]
bpy.context.scene.frame_set(key)
a.location.x = a.location.x + 0.015
a.location.y = a.location.y + 0.022
a.location.z = a.location.z + 0.003
a.keyframe_insert(data_path='location', frame=(key))
i += 1