title: Split code to separate node js files or modules in Node.js bot framework
body: <p>I am building a chatbot application using the MS bot framework. I have two flows, they are flow1 and flow2. All the code is placed in app.js. I want to split it into different files: app.js, flow1.js &amp; flow2.js and I want to use flow1.js and flow2.js functions in app.js. </p>
  
  <p>Below is the app.js code</p>
  
  <pre><code>bot.dialog('Flow', [
      function(session, results) {
          builder.Prompts.choice(session, 'Please select the flow', 'flow1|flow2', { listStyle: builder.ListStyle.button });
      },function (session, results) {
          if(results.response.entity === 'flow1'){
              session.beginDialog('Flow1')
          }else{
              session.beginDialog('Flow2')
          }
      }
  ]).endConversationAction("stop",
      "",
      {
          matches: /^cancel$|^goodbye$|^exit|^stop|^close/i
          // confirmPrompt: "This will cancel your order. Are you sure?"
      }
  );
  
  bot.dialog('Flow1', [
      function(session, results) {
          builder.Prompts.text(session, "May I know your name?")
      },function (session, results) {
          session.userData.name = results.response
          builder.Prompts.text(session, "Hi! What is your favorite color?")
      },
      function(session, results) {
          session.userData.color = results.response.entity
          builder.Prompts.text(session, "Please enter color code?")
      },
      function(session, results) {
          session.userData.colorcode = results.response
          session.send('Your inputs &lt;br&gt;name: '+session.userData.name+
                      "&lt;br&gt;color: "+session.userData.color+
                      "&lt;br&gt;color code : "+session.userData.colorcode);
          session.endConversation();
      }
  ]).endConversationAction("stop",
      "",
      {
          matches: /^cancel$|^goodbye$|^exit|^stop|^close/i
          // confirmPrompt: "This will cancel your order. Are you sure?"
      }
  );
  
  bot.dialog('Flow2', [
      function(session, results) {
          builder.Prompts.text(session, "Please enter your user name?")
      },function (session, results) {
          session.userData.username = results.response
          builder.Prompts.text(session, "Please enter your password?")
      },
      function(session, results) {
          session.userData.password = results.response
          session.userData.colorcode = results.response
          session.send('Your inputs &lt;br&gt;username: '+session.userData.username+
                      "&lt;br&gt;Password: "+session.userData.password);
          session.endConversation();
      }
  ]).endConversationAction("stop",
      "",
      {
          matches: /^cancel$|^goodbye$|^exit|^stop|^close/i
          // confirmPrompt: "This will cancel your order. Are you sure?"
      }
  );
  </code></pre>