I would like to let my initializing script to create additional sensors/controller/actuators necessary for an interactive Blender application (not necessarily a game). This is preferable for two reasons:
- I can use this script in multiple applications. Creating common logic over and over again is tedious. And there is no other way to import AFAIK.
- Having my Python modules create logic bricks is much easier and comfortable for me since I'm a coder. (...and the code can be version controlled, peer reviewed, easily documented etc.)
Actually creating a template file partially addresses the first issue. But then I can't mix and match different parts for different projects, or I have to create a template for each possibility.
I have searched both the Game Engine docs and the Python API but couldn't find any clue. __init__
methods of logic bricks aren't even listed there.
But if there is any way to create logic bricks dynamically within Python I would like to try it.
NOTE: with my limited knowledge of BGE, you can't, for instance, access key presses directly from Python. A sensor is required.