Beside the Script task many shapes allow you to assign python code snippets to adjust process instance variables as desired.
This might become confusing when process models become larger.
Then it will be more useful to centralize the code in one script and provide the code snippets as functions inside the script.
To do so add a Script to your BPI-Project.
Type in a name for the script. This sample uses "MyScript.py"
Edit the script and create your functions as desired:
To bind the script to the shape open the expression editor of the shape and type: