Constraints with python

Hi - I’m currently running some tests with python API and I’ve found a strange problem:

import Blender
from Blender import *

scene = Scene.getCurrent()
empty1 = Object.New('Empty', 'Empty1')
empty2 = Object.New('Empty', 'Target')

trackto = empty1.constraints.__getitem__(0)
trackto.__setitem__(Constraint.Settings.TARGET, empty2)

this code seems to work fine except for one thing. When I move the target object the constrainted empty doesn’t react until moved, then it sets up properly. Anyone can explain to me why it’s that way?

have you tried

also getitem is the same as constraints[0]