# Include functions file in function node possible?

**URL:** https://discourse.nodered.org/t/include-functions-file-in-function-node-possible/36981
**Category:** General
**Created:** [4 December 2020 08:58 UTC](https://discourse.nodered.org/t/include-functions-file-in-function-node-possible/36981 "2020-12-04T08:58:40Z")
**Posts on this page:** 1
**Showing post:** 17

<div class="post-metadata">

### Author: ![msillano](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/msillano/32/17424_2.png) [@msillano](https://discourse.nodered.org/u/msillano)
#### Post date: [16 January 2021 18:13 UTC](https://discourse.nodered.org/t/include-functions-file-in-function-node-possible/36981/17 "2021-01-16T18:13:51Z")

</div>

Strange but it works:  
The global variable 'bigobj': (

```auto
{
some[]more[]{dx:"here"} , // array of objects with array of objects. The 'Config' node requires JSON.
.....
 "get_dx": "function( d,p) { return this.some[d].more[p].dx; }"
}

```

i.e. a JSON version of a function.... (all in one line ☹ )

USE:  
Inside a function node:

```auto
var bigO = global.get("bigobj");

function callJSONMethod(obj, fname, a, b, c, d){
    // see: https://stackoverflow.com/questions/49125059/how-to-pass-parameters-to-an-eval-based-function-injavascript
var wrap = s => "{ return " + obj[fname] + " };" //return the block having function expression
var func = new Function(wrap(obj[fname]));
return func.call( null ).call( obj, a, b, c, d); //invoke the function using arguments
}

msg.payload =callJSONMethod(bigO, "get_dx", 2, 2); 
return msg:

```

returns "here", unbelieve!  
i.e I must add the function callJSONMethod() to any function node using bigobj.....  
maybe acceptable.

Best regards

---

_[View the full topic](https://discourse.nodered.org/t/include-functions-file-in-function-node-possible/36981)._
