title: Require Module with Credentials Inside Function
body: <p>I'm using the Twilio library in nodejs. Whenever you require the library, you need to pass the accountSiD and your authToken to load the library. </p>
  
  <pre><code>const client = require('twilio')(accountSID, authToken);
  </code></pre>
  
  <p>As of now, I'm working on a project that requires the accountSID and the authToken to be dynamically changed, since the usage can be from different accounts.</p>
  
  <p>To call it, I'm passing the credentials to a function and then inside this, I'm requiring the twilio module.</p>
  
  <pre><code>async function sendMessage(accountSID, authToken, params){
      const client = require('twilio')(accountSID, authToken);
  
      client.messages.create(params).....
  }
  </code></pre>
  
  <p>I wanted advice to see if this is really bad practice or it is not that bad since the information is changing.</p>
  
  <p>Since I need to pass an accountSID and a authToken, when I call the module from the beginning, it creates an error that accountSID and authToken are not defined.</p>