Location change of child as gaming mode activated

I have two cylinders, one is the puck, other is the handle. The handle is child of the puck. They both have dynamic physics. I use python to define their motion. As soon as I hit p and enter gaming/testing mode, their locations are changed. But the handle has more dramatical location change than the puck.

Here is two photos of before and after hitting p:

Before:

After:

I cannot figure out why this sudden change of location and getting compressed in y direction.

Here is my script:

import bge

def main():
cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()
keyboard = bge.logic.keyboard
puck = cont.owner

# sensors
bottom_edge_collision = cont.sensors["bottom_edge"]

# keys
r_pressed = bge.logic.KX_INPUT_JUST_ACTIVATED == keyboard.events[bge.events.RKEY]

if r_pressed:
scene.restart()
print("rsrt", puck.localPosition)

main()


Here is my blend file: https://drive.google.com/drive/folders/1dcXSZ7HHZH9h8f6KFJWUsVmuRl69o6bd?usp=sharing

• You do not need "main()" and "def main()". It makes the code harder to read. – Monster Jan 16 '18 at 5:09