Python troubles

I’m slowly learning python, and i’m trying to do a simple test type script, here it is:

import Blender
obj=Blender.Object.Get("Plane")
obj2=Blender.Object.Get("Plane2")
obj.LocX = obj2.LocX/2

So object 1, the Plane, is supposed to get half of Plane2’s X location. It doesn’t work though. Why not? I have a motion actuator set up on Plane2, but when i try a print obj2.LocX it always returns the plane’s original location.

Pooba

-This kind of script doesn’t work in Game Engine.
You must use the GameLogic module instead.So if
you want an object to get the half X position of another
in Game Engine must do:

import GameLogic
Cont = GameLogic.getCurrentController()

Sphere = Cont.getOwner()
Cube = Cont.getActuator("act").getOwner()

Cube_pos = Cube.getPosition()
Sphere_pos = Sphere.getPosition()

Sphere.setPosition([(Cube_pos[0]/2),Sphere_pos[1],Sphere_pos[2]])

where a Sphere get the new position.The Python Controller
with the script must be connected with an Actuator named “act”
of the Cube.So you have these bricks:
Sensor of the Sphere – Python Controller of the Sphere –
Actuator of the Cube.

Ben