Moving stuff around with Python is (IMO) easier than creating whole mesh objects.
You make a Python object out of your mesh object like this:
obToMove = Blender.Object.Get(‘YourSphere’)
Assuming of course that the name of your created sphere is “YourSphere”
Then, you set the location of the object like this:
obToMove.setLocation(15,-4.2,7)
Then do a:
Blender.Redraw
This is how you set locations. If you want to actually have Python generate animation you can play back later, you need to record this in IPOs, which is a little more involved. Also, the IPO module is broken right now, so you can’t generate smooth IPO animation from within Python. I’ve made a fix for it, but it hasn’t entered the cvs yet.
Here’s code for making an IPO for the x-value of the object. You can dupe it for y and z as you see fit:
obToMove.clearIPO() #deletes any IPOs currently attached to the object
obIPO = Blender.Ipo.New('Object','obIPO') #creates a new, unlinked IPO object
obToMove.setIpo(obIPO) #links the new IPO to your object
obIPOX = obIPO.addCurve('LocX') #adds a curve for x-value
obIPOX.addBezier((3,15)) #set a key at frame 3, x-value 15
opIPOX.addBezier((5,10)) #set a key at frame 5, x-value 10
obIPOX.addBezier((10,0)) #set a key at frame 10, x-value 0, etc.
obIPOX.setInterpolation('Bezier') #set to smooth IPOs
obIPOX.Recalc #fix bezier handles
I know that seems like a lot to do, but you also need to make curves for the Y and Z values as well! Of course, once you have the curves made, you can just keep adding keys to them. If your script is making new keys procedurally, you only need to initialize and create the curves once.
Good luck.
Edit: added the double parans in the addBezier method.