28 views
Skip to first unread message

Khushbu Kella

unread,
Jun 8, 2022, 9:15:53 PM6/8/22
to jso...@googlegroups.com
How to import one function in another function.. function accepts some parameter..
importing the function to pass new values to the function.. 


abc.jsonnet
local Myfunction2(x,y) = x+y;

test.jsonnet
local Myfunction = import 'abc.jsonnet';
{
res2:Myfunction.Myfunction2(1,2)
}

This message and its attachments are confidential (or legally privileged) information and are meant solely for the addressee of such message. Any unauthorized use of the message / its attachments is strictly prohibited.

jer...@grafana.com

unread,
Jun 9, 2022, 4:11:39 AM6/9/22
to Jsonnet
a `local` is not available outside the file, do it like this:

// abc.jsonnet
{
  Myfunction2(x,y): x+y,
}

// test.jsonnet
local abc = import 'abc.jsonnet';
{
  res2: abc.Myfunction2,
}

Reply all
Reply to author
Forward
0 new messages