title: how to access parent module data in child file in node.js
body: <p>my file are like avilabele this sturucture.</p>
  
  <p><a href="https://i.stack.imgur.com/OhWMH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OhWMH.png" alt="enter image description here"></a></p>
  
  <p><strong>sample.js</strong> is root file and <strong>test.js</strong> is avilable in <strong>xx</strong> folder.</p>
  
  <p><strong><em>sample.js</em></strong></p>
  
  <pre><code>    var name={
     h:14
  }
  module.exports=name;
  </code></pre>
  
  <p><strong><em>test.js</em></strong></p>
  
  <pre><code>var name=require('./sample.js')
  console.log(name.h);
  </code></pre>
  
  <p>when a run test.js code using command prompt :  </p>
  
  <blockquote>
    <p>node test.js                             </p>
  </blockquote>
  
  <p>it gives error like :</p>
  
  <blockquote>
    <p>Cannot find module './sample.js'</p>
  </blockquote>