title: How to send a variable inside of a function to be accessed in another file in Nodejs
body: <p>I have 2 files named test.js and test2.js , I write a function in test1.js which stores a value in a variable from the function call, but I am unable to access that value in the variable in test2.js file. Whenever I try to do that, it shows undefined.</p>
  <p>Can someone please guide me through the same</p>
  <p>here are what my 2 files look like</p>
  <pre><code>let det='';
  let fine='';
  async function init(key)
  {
      try{
  
          det=pkey;
          console.log(pkey);
          fine = uuidv4();
          console.log(fine);
          
      }
      catch(error){
          console.error(error);
      }
  
  }
  </code></pre>
  <p>Now I want to access both det and fine in another file named test2.js , where I use axios</p>
  <pre><code>
  async function getAll(){
      try{
              const response=await axiosClient.get('/shoes',{ headers: {&quot;key&quot; : `${det}`,&quot;sess&quot;:`${fine}`}});
              console.log(response.data);
      }
      catch(error){
          console.error(error);
      }
     
      
  }
  module.exports.getAll=getAll;
  </code></pre>