Workflows can create, set and read parameters, called variables. You can access these in python. Look in editorial help > scripting with python > workflow and the workflow actions set variable and generate text