Blender 2.54b: "import bge" or bge.logic doesn´t w

User-contributed CVS development builds. Please test and give feedback!

Moderators: jesterKing, stiv

Post Reply
Posts: 0
Joined: Wed Sep 29, 2010 5:50 pm
Location: Germany

Blender 2.54b: "import bge" or bge.logic doesn´t w

Post by shoxy » Wed Sep 29, 2010 6:10 pm


Blender is great and I love it especially the simplifications in v2.54.

My problem:
The documentations about the Python GameEngine API is neither correct or I have a problem with my blender/system/etc.

I have tried "import bge", import bge.logic", "bge.logic.getCurrentController()"... all tries led to an error that the bge library is missing.

The old Blender versions always used the installed python. Version 2.54beta uses python from a Blender subfolder, at least the blender-console tells me so. Aaand: inside these subdirectories isn´t any kind of "" or compareable files... probably this doesn´t mean anything but I found the "bpy" which is working inside my scripts. Could it be that there are just the game-engine python-modules missing?

Blender 2.54 works quite fine: but I need the game-engine scripting for usage with my thesis.

I don´t know what to do now, I hope for your help! :cry:

Posts: 0
Joined: Sun Oct 17, 2010 6:07 am

Post by bandit » Sun Oct 17, 2010 7:00 am

I'm having the same problem -- it just gives the error "ImportError: No module named bge". No sign of an answer turned up after quite a bit of searching either.

I've seen people importing bge elsewhere in sample scripts (the API in included in "elsewhere"), so I don't think it's incorrect...but alas, it just won't let me do it.

Any insights?

Posts: 0
Joined: Sun Oct 24, 2010 4:14 pm

Post by dragly » Sun Oct 24, 2010 4:18 pm

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.

I'm just learning this myself, but I came over the same problem and figured it out thanks to another post in the forum.

Posts: 0
Joined: Sun Sep 12, 2010 3:10 pm
Location: Venezuela

Post by dokuro » Wed Jun 29, 2011 5:40 pm

can you share a link with the discussion on blendartist?

Posts: 0
Joined: Tue Oct 11, 2011 10:21 pm

Post by Daedelus » Thu Oct 13, 2011 3:19 pm

I was wondering if anyone ever got this figured out?

Posts: 0
Joined: Wed Oct 21, 2009 10:53 am

Post by xaedro » Fri Oct 14, 2011 7:34 am

from bge import logic as g

I have Blender 2.59

BTW: Mathutils is now mathutils.

Even you can use this:

from bge import logic as GameLogic
import mathutils as Mathutils
from mathutils import *

and your Blender v2.49 code can run in Blender v2.59 with less chages.

Post Reply