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
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ā