BGE Python: No module name 'BGE' I can not get Python to work, I have followed YT videos and do exactly what they have done but I only get error message:


  No module name 'bge'


I have searched on Google, but I cannot find similar answers. What is wrong?

At the top of my script I do have import bge

Although, I read somewhere that the inport BGE has changed.

But I'd really like to get this to succeed.
I can get my game to work without python but I'd rather not and it would make it too complicated.

I'm using version 2.77.

Here is my blender file
 

And this is the Script I trying

import bge


def main():

    cont = bge.logic.getCurrentController()
    own = cont.owner

    message = cont.actuators["message"]
    remove = cont.actuators["remove"]

    own.text = "I don't want to talk."

    if own["time"] &gt; 0:
        own["time"] -= 1

    if own["time"] &lt;= 0:
        cont.activate(message)
        cont.activate(remove)   

main()


Also this is the youtube clip I follow. https://www.youtube.com/watch?v=8klSGN1m5no&amp;list=LLi0N8WDVMrYgCK_ni5ajv5g&amp;index=5
BGE is lower case when used in python.

Try;

import bge


Also make sure you are running your script inside the game engine rather than with the 'run script' button. The 'run script' buttons is for addons. To run a script in the game engine you use the python controller logic brick.