title: How to access global variables from required() file in Node?
body: <p>Let's say I have 2 files: <code>main.js</code>, and <code>module.js</code>:</p>
  
  <pre><code>//main.js
  const myModule = require('./module');
  let A = 'a';
  myModule.log();
  
  
  //module.js
  module.exports = {
     log() {
         console.log(A);
     }
  
  }
  </code></pre>
  
  <p>When calling <code>myModule.log</code>, <code>A</code> is not defined. Is there any way I can make global vars from <code>main.js</code> available in <code>module.js</code>? Thanks.</p>