Pass event or source object to runScript expression

Is it possible to pass the event or source object into a runScript function in an expression binding?

I’m trying to use scripting functions to create a linear gradient, and using an expression binding on a rectangle’s fillPaint to call the script function via runScript.

I realise it might be easier just to use an event script, but I’m also wondering if the runScript is a possibility as well.

runScript() can call custom methods of the component it is attached to, which makes self available. See also the property provided to scripts in my objectScript() expression function. The latter was created to make what you are looking for possible, along with passing true dynamic arguments.