# How to translate a bone with IK in pose mode using the python API

I create an script that loads a .json file, which contains the joins and bones positions, and create a skeleton with IK based on that information. Everything works as it should be, however, when I am in pose mode, I can rotate my selected bone trough the the python API with the following command:

bpy.ops.transform.rotate(value=radians(-45), axis=(1,0,0))


The following image shows the result of the rotation on my torso:

the command above will rotate my selected bone as I wish. The problem is with the translate function, when I translate the bone trough the User Interface, everything works perfectly (even the Inverse Kinematics), so I was wondering what command should I perform in my script to achieve the same effect in translation that I achieve with the mouse (clicking G, then move the mouse cursor, left click), like the following image:

So I am really looking foward for a way to achieve this effect trough python code, without the UI interaction. By the way, the following command does not work (I do not know why tough) bpy.ops.transform.translate(value=(1,0,-5)).

Just another question that could solve all of my problems, is there a way to see what commands is the blender UI applying to the skeleton so I could just copy the command of whatever I am doing to the script to achieve whatever I desire?

Thank you so much.

Yes, you can run blender with the --debug flags. For example:
./blender --debug-wm

./blender --debug-all