How to set locales for ScriptManager

I use runFunction from ScriptManager for running jython functions, but I am not able to call nothing from project libraries within my function. It is out of scope. How can I set it?
I can set locales with runCode and it works. But I need the same with runFunction.

Thank you

What are you trying to do that requires changing the locale?
That is, maybe thereā€™s another way to do what youā€™re trying to do? In Perspective, for instance, we set various threadlocals from the session environment before executing the code, and then any Java functions that are called by the userā€™s code can just read that ThreadLocal.

I donā€™t want to change but add locals.
I noticed that compileFunction does it. So I use it now and it works.
I have another problem now. I am not able to access to props attribute from the function when I pass self variable as parameter from component OnStartup event. I can access to session attribute but not props.

Can you provide a snippet of code? Iā€™m not sure exactly what youā€™re trying to do.

Is the issue ā€œlocalsā€ or ā€œlocalesā€ ? (Very different things.)

1 Like

Sorry, I mean locals.

I have a Table component in Perspective.
I add script on event OnStartup.
There I have a code
while self.session.custom.running == True:
self.props.data = updateData.RefreshTable(self.session.custom.selectedDeviceNode)

updateData is a project library
RefreshTable creates new dataset for the table according to selectedDeviceNode
But when I get this code, pass the self variable as parameter like this:
def OnlineRefresh(sID):
while sID.session.custom.running == True:
sID.props.data = updateData.RefreshTable(sID.session.custom.selectedDeviceNode)

and I run it in ScriptManger.compileFunction(name).Invoke();
I get error ā€˜no attribute name propsā€™