Basic moving using python

Hi everyone, my name is Ilikedragon!

I have a very basic Python problem:
I’m using this script:

import Blender #gets all blender’s functions

a = Blender.Object.Get(“Cube”) #change the name of the object you want to get
a.LocX = 2000 #move the object’s location-x to 2.

…to try to move a cube ingame, but all it does is do nothing until the game is finished, and then move in object mode.

The importance of using Python here is I would like to move an object to the position of another object IN GAME and not have its position changed outside of the game.

Thanks v much!

Are you talking about the blender game engine? If so, you’re in the wrong forum :stuck_out_tongue:

If so, an always sensor linked to a python script, thats something like this.
(I haven’t tested it)

import GameLogic #is this the right case?

cont = GameLogic.getCurrentcontroller()
own = cont.getOwner()

posx = 2
posy = 2
posz = 5

own.position = posx, posy, posz