back to main reference page
ReaScript is a feature that allows you to run Python scripts within REAPER.
From within the script, you can call any REAPER action, and also call back into most of the
REAPER API functions (the same API used by compiled REAPER plug-ins and extensions).
ReaScript can be used to create anything from advanced macros to full-featured REAPER extensions.
Note: REAPER on Windows formerly supported Perl scripts as well, but Perl support was removed
in REAPER version 4.14. ReaScript Perl will be reinstated when/if the Perl
To use ReaScript, you must have Python installed on your computer. ReaScript should work
with any version of Python between 2.7 and the current 3.x release.
OS X normally comes with Python already installed. If you don't already have Python,
it is available as a free download for Windows or Mac from multiple sources.
For 32-bit REAPER, you need 32-bit Python (regardless of the operating system).
For 64-bit REAPER, you need 64-bit Python.
A list of Python distributions is
Once Python is installed, REAPER should automatically detect it, and ReaScript will work.
If REAPER does not detect Python, you can enter the Python install directory in
REAPER preferences, under Plug-Ins/ReaScript.
top ReaScript Documentation and Reference
From within REAPER, under the Help menu, choose "HTML lists/ReaScript documentation".
This will open a web page with some basic documentation, and a complete list of all REAPER API
functions that can be called from ReaScript.
There is extensive online documentation for
top Running ReaScripts
You will need to either write a script, or copy a script from another user.
Scripts can be placed anywhere on your disk, but it's convenient to keep them all in the
REAPER/Scripts application data directory.
To write a new script, show the Actions list (bound to the ? key by default), and click
ReaScript: New/Load. You will be prompted for the location to save your new script.
The default location is the recommended REAPER/Scripts application data directory.
Name your script something like test.py, then click ReaScript: Edit. A text editor will open.
The simplest possible ReaScript is:
Save the ReaScript, and then click Run. You should see a window that says "Test OK".
Common reasons for the script failing are:
- Python not installed
- REAPER cannot find the installed Python
- Syntax error (typo, missing newline, incorrect indentation in Python)
You can treat a ReaScript just like any custom action: bind it to a key shortcut, MIDI controller,
or toolbar button. ReaScripts can also be run a la carte, via the actions "ReaScript: run..."
and "ReaScript: run last script".
top Calling REAPER Actions
You can call any REAPER action from ReaScript by using the API function
Find the action number for a given action by opening the Actions list, and scrolling the window right
to reveal an extra column. For example, from ReaScript you would call the REAPER action
"Item: Split item under mouse cursor" like this:
If you use ReaScript as an advanced macro language, this is the only API function you need to know.
top ReaScript API
ReaScripts also have access to most of the
REAPER Extension API
For a list of all API functions available to ReaScripts, see the
built-in ReaScript documentation
That help page will explain the basics of how to call API functions, which may require
idiosyncratic syntax, because API functions can return information in the parameter list
as well as the function return value. For convenience, there are also
basic API functions for getting information from, and showing information to, the user.
You can set a custom editor for Python scripts in REAPER's Preferences/External Editors,
by assigning an application to the ".py" extension.
ReaScripts can keep persistent state by using the API functions
RPR_SetExtState() and RPR_GetExtState(). This allows ReaScripts to set key/value pairs
(similar to a Python dictionary) that will persist between ReaScripts, and optionally
persist between REAPER instances as well. For example, a module called "utility" might
want to remember that some flag is set:
RPR_SetExtState("utility", "someflag", "2", True)
val=RPR_GetExtState("utility", "someflag") # even if called after REAPER is closed and reopened, val will be equal to "2"
You can create and save modules of useful functions that you can import into other ReaScripts.
For example, if you create a file called reascript_utility.py that contains the function
helpful_function(), you can import that file into any ReaScript with the line
and call the function by using
Note that reascript_utility.py must itself import reaper_python, with the line
from reaper_python import *
(Although it is not required, it is good practice to start all ReaScripts with that line.)
For more help on ReaScript, to report bugs, to request additional API functions,
to share ReaScripts, or just to discuss the possibilities, please use the
REAPER ReaScript Forum.