The question is almost the same one that has been published before. But I think it's good to treat it again because it is not very clear, at least, for me.Also it does not have an accepted answer.
I want to draw a line using:
bge.render.drawLine(fromVec, toVec, color)
Draw a line in the 3D scene.
Parameters:
fromVec (list [x, y, z])
– the origin of the line
toVec (list [x, y, z])
– the end of the line
color (list [r, g, b])
– the color of the line
but I get a error message:
NameError: name 'bge' is not defined
Reading the question someone did before, first I put enable the game engine by selecting it in the render engine menu:
But I get an error when a try to import bge
ImportError: No module named 'bge'
bge
module is only valid while a game is running in Blender. You'll have to execute it with a Python controller. $\endgroup$bgl
module $\endgroup$