1
$\begingroup$

I'm trying to script some things in version 2.71.

To get the controller of a script, I have tried bge.logic.getCurrentController , but bge apparently is not present (unable to import). I've also tried bpy.ops.logic.getCurrentController , but logic does not have getCurrentController

Is there something obvious I'm missing? or what new command replaced this functionality? This roadblock is wasting a lot of time that could have been very productive.

Any help is appreciated

$\endgroup$
4
$\begingroup$

My understanding is that you must run your python script from a controller brick. The import will not work from the TEXT view. For example, the following simple script prints hello in the system console (Window->Toggle System Console) when the h key is pressed.

enter image description here

Clicking on the 'Run Script' button in the TEXT view will not work.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.