Custom Method from Expression (runScript()) in Perspective

I have a custom method on a table component called populate(), the script runs fine from an event script but when calling it in an expression binding on the same component I am getting Error_ExpressionEval. The method takes no arguments as it only accesses the custom properties on the component.

I have seen in previous posts that expression can access ‘self.’ in vision but is this the case in perspective. Am I wasting my time here?

For information, a functionally identical script works from the project. namespace

How are you accessing custom properties on the component without feeding any parameters? Can you post the function populate?

def populate(self):
	"""
	Custom method that can be invoked directly on this component.

	Arguments:
		self: A reference to the component that is invoking this function.
	"""
	import DbInterface.DbInterface as dbInterface
	
	# populate local var
	
	query = self.custom.query
	
	editable = self.custom.editableCols
	
	try:
	    visibleHeaders = eval(self.custom.visibleColumns)
	except TypeError:
	    visibleHeaders = self.custom.visibleColumns
	

Above is a code snippet of how the custom properties are accessed. This runs ok from an event script.

You need to pass on self into the function for it to work I believe, as I don’t think runScript will do this automatically.
runScript('shared.populate(self)', 0)

Sorry that is a misunderstanding. the snippet I posted is from within the custom method. I want to call the custom method from the expression as runScript(‘self.populate()’, 0 )

ah sorry, OK I’ll try that… no passing self into the custom method didn’t work.