title: JavaScript ES6 Modules - looking for equivalent to window[functionNameString]()
body: <p>I'm converting my JavaScript code to ES6 modules for better modularity.</p>
  <p>A common pattern in my code is to define a string that contains the name of a function:
  <code>let nextMethodName = &quot;aFunctionName&quot;;</code></p>
  <p>Then, sometime later, in a general event handler, I'll execute that function using:
  <code>window[nextMethodName]();</code></p>
  <p>Now I'm trying to do the same kind of thing inside module code.</p>
  <p>So, if the function I want to eventually execute is inside a module, I'll have:</p>
  <p><code>import * as myModule from &quot;/JavaScript/myModule.js&quot;;</code></p>
  <p>I can execute my function directly:
  <code>myModule.aFunctionName();</code></p>
  <p>but I can't seem to be able to figure out how to do something similar to
  <code>window[myFunctionName](); </code></p>
  <p>myModule does not appear to be an object in window, so I can't do something as simple as:
  <code>let nextMethodName = &quot;myModule.aFunctionName&quot;;</code></p>
  <p>How can I pass the name of a function to be executed, or a reference to that function, to my event handler? This would seem to be a very simple question, but Mr. Google and I have not been getting anywhere useful.</p>
  <p>Thanks!</p>