I have to work with strings to execute functions. So I created a new function where i put the string. It works but not when I want to call a specific function in another module :
var mymodule = require('./mymodule');
...
mymodule.function(a, b); //Works
var functionTest1= new Function('var a = 2; console.log(a*a);');
functionTest1(); //Works
var functionTest2= new Function('mymodule.function(a, b)');
functionTest2(); //Doesn't work (error console : mymodule is not defined)
What am I doing wrong? Is there an other way to do it ?