How to invoke a library function from another library function (defined in another element)?
Question
Let's say I have Element1 including function f1:
def f1() {
return 1
}I tried to invoke f1 from f2 defined in Element2. Both elements are in __LIBRARY__ logic.
def f2() {
return lib.Element1.f1() + 1
}and I got an error "No such property: lib".
I also tried:
def f2() {
return Element1.f1() + 1
}which works in a regular logic but in the library I'm getting error "No such property: Element1".
I'm calling f2 in this way:
lib.Element2.f2()Element1 is defined before Element2.
What is wrong? Is there any way to call f1 from f2?
Answer
You have to call f1 through libs.__LIBRARY__.Element1:
def f2() {
return libs.__LIBRARY__.Element1.f1() + 1
}Found an issue in documentation? Write to us.