The external_script item is an alternative way of including Python code in your experiment. Whereas the inline_script allows you to enter Python code directly, the external_script item runs Python from a script file.
The following options are available:
Script file is the name of the script that is imported
Prepare function in script is the name of the function in the script that is called during the prepare phase. This function must accept a single parameter, which is used to pass the item.
Run function in script is the name of the function in the script that is called during the run phase. This function must accept a single parameter, which is used to pass the item.
The following is an example of a script which displays a fixation dot for 1 second. The canvas is prepared in the prepare script and shown during the run script, to avoid timing issues.
import openexp.canvas c = None def prepare(item): global c c = openexp.canvas.canvas(item.experiment) c.fixdot() def run(item): global c c.show() item.sleep(1000)