## Scripting Scribus with Python

### Overview

This is the description how to use the scripting plug-in for Scribus. The Scripter allows you to use the powerful Python programming language as a scripting language in Scribus. This can help you to automate otherwise repetitive tasks or add new features.

Note that additions to the Scripter are being made frequently, which means that the available documentation may be incomplete.

### Scripter and Windows

If you installed your Windows version of Scribus using the installer at Sourceforge, the installation includes Python 3.7 in a directory labeled python\. This will suffice for most uses. You may find or write some Python script which requires an additional Python package not included, and there is no way to add these to the Scribus directory. Chances are, your system is not even aware of this Python.

Should you need to use some additional packages, the answer comes from installing Python 3.7 on your system, then also the desired additional packages. The next and important step is to use a file manager to go to C:\Program Files\Scribus 1.5.6\ and look for a directory named python\. Simply rename this to anything else, such as oldpython\, and the next time Scribus starts, it will use the system Python and its packages.

### Using the Plug-in

Scribus is being shipped with some “hard-wired” scripts, which are available via Scripter > Scribus Scripts:

There are some simple example scripts in the subdirectory “samples.” Its location depends on the operating system you use, e.g. `/usr/local/share/scribus` or `/usr/share/scribus` on Linux. If you have created a script which you think could be useful for others, please feel free to add it to the Scribus Wiki or paste it into an email and send it to the Scribus mailing list.

To execute an external Python script, you have to use Script > Execute Script. Scribus will open a file dialog, which allows you to select a Python script (file extension: *.py). Script > Recent Scripts shows a list of recently executed scripts.

You can use many Python modules with this plug-in, the only exception being scripts that expect parameters from the command Line. These won’t work because the plug-in gives the Python interpreter an empty command line.

The menu entry Script > Show Console will launch an interactive Python console, where you can execute commands directly. There is no need to use “`from scribus import *`”, as this has already been done. You can use all the commands listed in the following pages of the Scripter API documentation directly without any prefix.