title: Module exports class and function
body: <p>Having a class Visual:</p>
  
  <pre><code>class Visual {
      constructor() {...}
      async fun1() {...}
      async fun2() {...}
  }
  module.exports = Visual;
  </code></pre>
  
  <p>here everything works fine. However, I need to change it in order that <code>fun1</code> depends on the output of <code>fun2</code>.</p>
  
  <p>Firstly, I tried to use it the "normal" way but said the function is not defined.</p>
  
  <pre><code>async fun1() {
      const result = await fun2();
      ...
  }
  </code></pre>
  
  <p>So I tried another way, to move the function outside the class by exporting it.</p>
  
  <pre><code>    class Visual {
          constructor() {...}
          async fun1() {
                 const result = await fun2();
                 ...
          }
      }
      module.exports = Visual;
      module.exports = {
          fun2: async function () {...}
      };
  </code></pre>
  
  <p>The code inspector doesn't say anymore that fun2 is not defined but when a new Visual is created it says it is not a constructor.</p>
  
  <pre><code>const visual = new Visual();
  </code></pre>
  
  <p>Is it wrong the way it is exported? How can I solve it?</p>