How to pass command line arguments through Blender without IndexError thrown?
All the parameters before &quot;--&quot; (+ 1 makes it inclusive) have been skipped here. The second line overrides the sys.argv to hold only items that go after &quot;--&quot;, which is an array of length 2 containing [1, 2].
index = sys.argv.index(&quot;--&quot;) + 1
sys.argv = sys.argv[index:]

Array indices start from 0. You are trying to access a third parameter here
angle_movement = sys.argv[2]

This causes the out of index exception.
Should be
foot_position = sys.argv[0]
angle_movement = sys.argv[1]