Forum Discussion
Access variable library in UDF
Hi bruinsmm ,
I ran into the same issue before — the Variable Library wasn’t showing up in the UDF connection manager. It turned out that I hadn’t actually added the variable library as a connection inside the UDF.
Here’s what worked for me:
Go to your workspace and make sure your Variable Library is created and published.
In your User Data Function, open the Connection Manager and click Add connection → choose Variable Library.
Select your variable library and give it an alias name (for example, MyVarLibAlias).
Use that same alias in your code:
@udf.connection(argName="varLib", alias="MyVarLibAlias")The alias must match exactly what you gave in the connection manager.
If you still don’t see the variable library in the list, try refreshing the UDF page or check that you have permission to access it in the workspace.
Once the connection is set up, your code should work fine — you’ll be able to read the variables using:
variables = varLib.getVariables()
Hope that helps!
Gopi Krishna