title: When i try to call a function in my node.js electron app it throws an error. Function not defined at click event
body: <p>In my <strong>node.js</strong> electron app, I got an error when I tried to call a function inside of my <code>bot.js</code>. I tried this:</p>
  <pre><code>&lt;button type=&quot;button&quot; class=&quot;startbutton&quot; id=&quot;startbutton&quot; onclick=&quot;init()&quot;&gt;Start Bot&lt;/button&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;
      require('./bot')
  &lt;/script&gt;
  </code></pre>
  <p>It always gives me the error <a href="https://i.stack.imgur.com/c6QZE.png" rel="nofollow noreferrer">Screenshot of the error.</a></p>
  <pre><code>function init() {
  client.on('ready', () =&gt; {
      console.log(`Logged in as ${client.user.tag}!`)
  })
  
  client.on('message', msg =&gt; {
      if (msg.content === 'ping') {
          msg.reply('Pong!');
      }
  });
  client.login('&lt;MyDiscordBotToken&gt;')
  }
  </code></pre>
  <p>Something is wrong, but I don't know what...</p>