Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Question

Let's say I

...

have Element1 including function f1:

Code Block
def f1() {
  return 1
}

I tried to

...

invoke f1 from f2 defined in Element2. Both elements are

...

in __LIBRARY__

...

 logic.

Code Block
def f2() {
  return lib.Element1.f1() + 1
}

and I got an error "No such property: lib". 

I also tried:

Code Block
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:

Code Block
lib.Element2.f2()

Element1 is defined before Element2.

What is wrong? Is there any way to

...

call f1 from f2?

...

hiddentrue

...

Answer

You have to call f1 through libs.__LIBRARY__.Element1:

Code Block
def f2() {
  return libs.__LIBRARY__.Element1.f1() + 1
}