Thank you both for the valuable hints!
The "class pattern" comment made me realize that a function within a function actually works like a class, and after realizing that several googled code snippets started making sense. The mention of "this." being able to access objects within that class solved the rest of the puzzle for me.
If someone would happen to stumble upon this question: The code below is a rewritten version of my simplified code above, this time in working order.
-- main.js --
var Logdata = require('trial')('This is the input data');
module.exports.loop = function () {
Logdata.logvalue()
}
-- trial.js --
var classStructure = function(input){
return {
savedinput: input,
logvalue: function()
{
console.log(this.savedinput)
}
};
};
module.exports = classStructure
It is also possible to add new function in the "Return" statement within trial.js. That function could then call this.logvalue to invoke the logvalue function.