Comrades, I figured out how to open a .blend file using an separate/external Python script, I would now like to know how to send instructions to the Python Interactive Console? The code below is run from a simple Idle Python3.3 module. The commented line does not work - any suggestions on how to fix this? I want to call the Embedded Player to run automatically from another script.

import os

def openFile():
        os.system('Python:bpy.ops.view3d.game_start()')#start embedded player??
    except Exception as e:
        print (e)

I am aware that making the .blend file a .exe will solve this problem but the will make development very slow as I will have to compile the BGE every time I change code... Thanks guys!

  • $\begingroup$ Why don't you run the game engine in Blender by hitting P during the development? It has a decent text editor with syntax highlighting. $\endgroup$ – CodeManX Apr 16 '14 at 19:43
  • $\begingroup$ Thanks, but I am trying to implement a program that makes use of semaphores (running two program simultaneously), so I need the .blend file to run the embedded player intimidatingly. If you know how to send the command that is executed when 'P' is pressed then I can send that through the Python IDLE master script to the BGE's Embedded Player. Any ideas on how to do this? $\endgroup$ – CubeBot88 Apr 17 '14 at 6:44
  • $\begingroup$ See related question: blender.stackexchange.com/questions/41533 $\endgroup$ – ideasman42 Jan 22 '16 at 7:13

If running the exe works, you could also open the blend with blenderplayer and not worry about exporting.

os.system('/path/to/blenderplayer.exe bob2.blend')

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.