title: How to create logic bricks programmatically in Blender?
body: <p>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:</p>
  
  <ul>
  <li>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.</li>
  <li>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.)</li>
  </ul>
  
  <p>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.</p>
  
  <p>I have searched both the <a href="http://www.blender.org/documentation/249PythonDoc/GE/index.html" rel="noreferrer">Game Engine docs</a> and the <a href="http://www.blender.org/documentation/249PythonDoc/index.html" rel="noreferrer">Python API</a> but couldn't find any clue. <code>__init__</code> methods of logic bricks aren't even listed there.</p>
  
  <p>But if there is any way to create logic bricks dynamically within Python I would like to try it.</p>
  
  <p><strong>NOTE:</strong> with my limited knowledge of BGE, you can't, for instance, access key presses directly from Python. A sensor is required.</p>