Not sure if Im understanding how these def really works.  Im trying to calculate speed.  When that speed is between 3 and 5 I want it to kick in the animation.  This animation is a looping animation.  Kind of like the above post from yesterday about the sun.  Anyways, when I run this it kicks off the animation when it shouldn't because the speed should be 0.  Then it only runs once.  I was thinking that since CalculateSpeed always stays runnning that it would keep checking the speed between 3 and 5.  If that was true it would kick it into the showFlower() and run once.  SO I need help, any suggestions would be much appreciated.
One more thing.  I want it to create a new image everytime its speed is between 3 and 5 and then removes that image after 3.5 seconds.
Thanks 
	Code:
	def CalculateSpeed(obj):
	
	#Get current and last position
	current_pos = obj.getPosition()
	last_pos = getattr(obj, 'last_pos', None)
	if last_pos is None:
		#This is first call, so save position and set speed to 0
		obj.last_pos = current_pos
		obj.speed = 0.0
		
	else:
		#Compute speed using last position
		obj.speed = vizmat.Distance(current_pos,last_pos) / viz.elapsed()
		obj.last_pos = current_pos
		if obj.speed > 3 and obj.speed < 5:
			showFlower() 
vizact.ontimer(.1,CalculateSpeed,ppt1)
def showFlower():
	flower = viz.add('flower_02.wrl')  #creates new flower
	flower.scale(.2,.2,.2)
	yield viztask.waitTime( 3.5 )  #waits 3.5 seconds
	flower.remove()  #then removes flower
viztask.schedule( showFlower() )