Also, you can actually do this in the project library if you pass the component info to the function:
Useful if you plan to use that code for more than one component.
I forget if for Perspective you need to pass a session handle as well or not. Might depend on what exactly you're doing.
EDIT: Passing the component (i.e. self from an event handler script) is enough to be able to modify prop values. Not sure what I was thinking about.