Python Editor

(Window > Python Editor)

The Python Editor provides a robust environment for end users to create scripts and tools, and to interact with MotionBuilder through Python.

The Python Editor lets you execute single-line scripts, multi-line scripts, and global scripts. It also enables you to configure MotionBuilder to receive scripts remotely, develop automation scripts, load and save script information as well as create custom MotionBuilder tools.

Some of the functionality supported by the Python Editor include:
You can execute specific code, like shortcut variables, when the Python Editor is launched by adding them C:\Users\<username>\Documents\MB\<version>\config\Python\pythonidelib_init.py. For example, adding scn = FBSystem().Scene to this file lets you use the shortcut variable scn in the Python Editor each time the editor is launched.
Note: If pythonidelib_init.py does not exist, open the Python Editor and then close MotionBuilder to trigger its creation.

The Python Editor tool consists of the following areas: the toolbar, the interactive console, and the work area.

Python Editor: A. Toolbar B. Interactive console C. Work area

You can resize the Python Editor window by dragging any corner or border of the window, and the Python preferences let you set several other options, including whether tabs in the Work area will display x/Close buttons.

Python Editor toolbar

You can access most Python Editor commands from the Python Editor toolbar.

Python Editor toolbar

See also Accessing Python Editor commands.

Python Editor interactive console

The Python Editor interactive console is similar to the Python IDLE. It provides feedback on the code in the Python Editor active work area. Errors, results from executed scripts and other feedback is also displayed in this console.

See also Using the Python Editor interactive console.

Python Editor work area

The Python Editor work area provides a workspace area for writing scripts, dragging and dropping scripts, commenting and uncommenting scripts.

See also Using the Python Editor work area.