title: How to call function from one js file to another
body: <p>I have a function defined inside  in HTML which is of module type.I need to call that function from another js file included in that same HTML file. When I call a function from a js file, it is referred to as reference error.</p>
  
  <p><strong>This is what I have in my HTML file</strong> :</p>
  
  <pre class="lang-html prettyprint-override"><code>
  &lt;script src="../src/viewer.js"&gt;&lt;/script&gt;
  &lt;script type="module" src="../pravintest/player.js"&gt;&lt;/script&gt;
  
  </code></pre>
  
  <p>In <em>viewer.js</em> file I have a code where I call a function <em>crossdatacheck(param)</em> which is in player.js.</p>
  
  <p>This is my player.js file: </p>
  
  <pre class="lang-js prettyprint-override"><code> import * as THREE from './threejs/build/three.module.js';
          import { GUI } from './threejs/examples/jsm/libs/dat.gui.module.js';
          import { OrbitControls } from './threejs/examples/jsm/controls/OrbitControls.js';
          import { NRRDLoader } from './threejs/examples/jsm/loaders/NRRDLoader.js';
          import { VolumeRenderShader1 } from './threejs/examples/jsm/shaders/VolumeShader.js';
          import { WEBGL } from './threejs/examples/jsm/WebGL.js';
  
  
          var renderer,
              scene,
              camera,
              controls,
              material,
              volconfig,
              cmtextures;
  
           function crossdatacheck(data) {
          console.log(data);
           }
  
  </code></pre>
  
  <p>I want to call this function from the viewer.js file.</p>
  
  <p>When I call a function from viewer.js there is an error ->  <em>reference error</em>: <em>crossdatacheck function is not defined in viewer.js</em>
  Can anyone suggests to me how can I do this?</p>