title: calling async function from different routes get different results
body: <p>I have an async function called &quot;teteraQueryDb()&quot; that fetches data from a Db in a route like :/root/afolder/bfolder/file.js The function is exported like: module.exports.teteraQueryDb = teteraQueryDb</p>
  <p>When I try to call the function from a file in the same route I do this and is succesfull:</p>
  <pre><code>const teteraProvDb = require('./readingProvTetera');
  
  (async(teteraProvDb) =&gt;{
  
      var newTeteraProvDb = await teteraProvDb.teteraQueryDb().then((te) =&gt; {return te})
      console.log(newTeteraProvDb)
      
  })(teteraProvDb);
  </code></pre>
  <p>But doing this from the root, I can't fetch the data and I get &quot;undefined&quot;:</p>
  <pre><code>const teteraProvDb = require('./afolder/bfolder/readingProvTetera');
  (async(teteraProvDb) =&gt;{
  
      var newTeteraProvDb = await teteraProvDb.teteraQueryDb().then((te) =&gt; {return te})
      console.log(newTeteraProvDb)
      
  })(teteraProvDb);
  </code></pre>
  <p>This is the configuration of readingProvTetera.js:</p>
  <pre><code>const sqlite3 = require('sqlite3').verbose();
  const dbRoute = '../../myDb.db'
  
  function teteraQueryDb(){
  
      let db = new sqlite3.Database(dbRoute, err =&gt;{
          console.log(err)
      })
      return new Promise (resolve =&gt;{
          db.all(&quot;SELECT DISTINCT * FROM tetera&quot;, (err, rows) =&gt;{
              if(err){
                  console.log(&quot;Something went wrong with the query&quot;);
              }
              resolve(rows) 
          })
      })
      db.close()
  }
  
  module.exports.teteraQueryDb = teteraQueryDb
  </code></pre>
  <p>Why? Am I missing somethig with the scopes?</p>