Lock rotation of an object in physics


I want to fix the rotation of an object in the dynamics world.
Note that I have already tried “rigid body constrains” (using generic constraint) to do so, but because the my object experiences high impacts, it still rotates!

Here it is mentioned something about locking rotation of an object, however, I dont know how to apply that.

Besides, when I type “import bge” in the python console, I get this error “No module named bge”.
I googled about this problem, even when I already initialize game engine by pressing “p” I get the same error again.

Thank you beforehand.