Reputation: 713
i just started learning blender and its scripting and tried to run its sample code
import bge
def main():
cont = bge.logic.getCurrentController()
own = cont.owner
sens = cont.sensors['mySensor']
actu = cont.actuators['myActuator']
if sens.positive:
cont.activate(actu)
else:
cont.deactivate(actu)
main()
and get the following error: ImportError: No module named 'bge' i searched for a solution but couldn't find any.how to solve this problem? i am using blender 2.65
Upvotes: 8
Views: 4648
Reputation: 1
Upvotes: 0
Reputation: 944
Running import bge does not work when you press "Run script" or try to issue this command in the terminal. You have to press "P" to activate game engine mode. To run your script, connect a controller to the script.
Upvotes: 11