Game Guides > Game FAQ >  

How do you use Blender with Python

How do you use Blender with Python
There are several ways. First, Blender's user interface was written in Python, and most of the commands and menus are actually Python functions. Blender actually contains the Python interpreter, and uses it extensively. Go to the Scripting view, and you'll see an interactive console. The python version exposed is based on your Blender version, but you'll typically see Python 3.? for newer versions of Blender. You can interact with Python in command-line mode here as with any Python interpreter. The scripting view also contains a text editor optimized for Python coding. Turn on syntax highlighting and choose from the Templates menu to see a number of interesting Python scripts. Most of these scripts can be run directly to control Blender through the command interface. This allows you to build automated scenes through program code. Finally, you can use a Python script as a controller in the game engine. This accepts input from sensors and passes output to actuators. However, your code can manipulate input and output any way you want, turning the Blender game engine into a full-blown 3D game development toolkit.