The following is a very simple example of just how we can construct concurrent Python applications using the PyCSP module. As you can see, we define two distinct functions, Process1 and Process2. We then decorate these functions with the @process annotation, and this handles turning the entirety of this method into a process for us. We then tell our PyCSP-based program to run both process 1 and process 2 in parallel to each other:
from pycsp.parallel import *
import time
@process
def Process1():
time.sleep(1) # Sleep 1 second
print('process1 exiting')
@process
def Process2():
time.sleep(2) # Sleep 2 seconds
print('process2 exiting')
Parallel(Process1(), Process2()) # Blocks
print('program terminating')