Py Scripts in upbge 0.42

guys . i don’t understood when i write import bge then i run script blender
log always write this message module not found error : no module named bge
I have tried import bpy module but when i use logic like bpy.logic log write error message atrribute error: module 'bpy' has no atrribute 'logic'
i need help tell me in comments :point_down:

scripts that import bge are meant to be run in-game with a logic-brick “Python-Script”. You can’t run them in the Text Editor.

Scripts that use “import bpy” are Blender-Scripts that usually get executed in the Text Editor.
(but UPBGE 0.3+ also support these in-game when running via logic-Brick when you know what you are doing)

1 Like

So this means that the text is correct if you run it with the game but is incorrect if you run it with a text editor
So that what i should do (when I want to run the script, I run it with the game)

So this means that the text is correct if you run it with the game but is incorrect if you run it with a text editor

The script launcher did not run the script like it does when I run it in the game

I don’t understand. post a blend

blend file for the script

oh i understand . bge is working thank you for solving error! :smile: :ok_hand:

1 Like