Calling a subroutine from python

So is seems after further testing the python script with call a subroutine from within a function. It wont work if I am setting a variable from a property to call the function.

So the part which doesn’t work is setting the variable from a property drop down box on the robot model.

prop2 = comp.getProperty(“PartChoice”)
prop2 = comp.createProperty(VC_STRING, ‘PartChoice’, VC_PROPERTY_STEP)
prop2.StepValues = [‘part1’…etc

def test(prop2):
routine = robot_executor.Program.findRoutine(“Pick”)
if routine:
robot_executor.callRoutine(routine)

prop2.OnChanged = test

 

I am therefore thinking of another way to sent the request for parts