title: Error: ```Uncaught ReferenceError: am4core is not defined``` while creating Amcharts 4 chart
body: <p>when creating a column chart using the Amcharts4 library I get the following error message:</p>
  <p><code>Uncaught ReferenceError: am4core is not defined</code></p>
  <p>My code is as follows:</p>
  <p><strong>JS</strong></p>
  <pre><code>am4core.ready(function() {
  
    // Themes begin
    am4core.useTheme(am4themes_animated);
    // Themes end
  
    // Create chart instance
    var chart = am4core.create(&quot;chartdiv&quot;, am4charts.XYChart);
  
    var chartData = [{
      &quot;category&quot;: 2009,
      &quot;income&quot;: 23.5,
      &quot;url&quot;: &quot;#&quot;,
      &quot;description&quot;: &quot;click to drill-down&quot;,
      &quot;months&quot;: [{
        &quot;category&quot;: 1,
        &quot;income&quot;: 1
      }, {
        &quot;category&quot;: 2,
        &quot;income&quot;: 2
      }, {
        &quot;category&quot;: 3,
        &quot;income&quot;: 1
      }, {
        &quot;category&quot;: 4,
        &quot;income&quot;: 3
      }]
  
    }, {
      &quot;category&quot;: 2010,
      &quot;income&quot;: 26.2,
      &quot;url&quot;: &quot;#&quot;,
      &quot;description&quot;: &quot;click to drill-down&quot;,
      &quot;months&quot;: [{
        &quot;category&quot;: 1,
        &quot;income&quot;: 4
      }, {
        &quot;category&quot;: 2,
        &quot;income&quot;: 3
      }, {
        &quot;category&quot;: 3,
        &quot;income&quot;: 1
      }, {
        &quot;category&quot;: 4,
        &quot;income&quot;: 4
      }]
    }, {
      &quot;category&quot;: 2011,
      &quot;income&quot;: 30.1,
      &quot;url&quot;: &quot;#&quot;,
      &quot;description&quot;: &quot;click to drill-down&quot;,
      &quot;months&quot;: [{
        &quot;category&quot;: 1,
        &quot;income&quot;: 2
      }, {
        &quot;category&quot;: 2,
        &quot;income&quot;: 3
      }, {
        &quot;category&quot;: 3,
        &quot;income&quot;: 1
      }]
    }];
  
    chart.data = chartData;
  
    // Create axes
  
    var categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
    categoryAxis.dataFields.category = &quot;category&quot;;
    categoryAxis.renderer.grid.template.location = 0;
    categoryAxis.renderer.minGridDistance = 30;
    categoryAxis.numberFormatter.numberFormat = &quot;#&quot;;
  
    categoryAxis.renderer.labels.template.adapter.add(&quot;dy&quot;, function(dy, target) {
      if (target.dataItem &amp;&amp; target.dataItem.index &amp; 2 == 2) {
        return dy + 25;
      }
      return dy;
    });
  
    var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
  
    // Create series
    var series = chart.series.push(new am4charts.ColumnSeries());
    series.dataFields.valueY = &quot;income&quot;;
    series.dataFields.categoryX = &quot;category&quot;;
    series.name = &quot;Income&quot;;
    series.columns.template.tooltipText = &quot;{categoryX}: [bold]{valueY}[/]&quot;;
    series.columns.template.fillOpacity = .8;
    series.columns.template.propertyFields.url = &quot;url&quot;; 
    
  
    var columnTemplate = series.columns.template;
    columnTemplate.strokeWidth = 2;
    columnTemplate.strokeOpacity = 1;
  
    var title = chart.titles.create();
    title.text = &quot;Yearly Data&quot;;
    var resetLabel = chart.plotContainer.createChild(am4core.Label);
    resetLabel.text = &quot;[bold]&lt;&lt; Back to Yearly Data[/]&quot;;
    resetLabel.x = 20;
    resetLabel.y = 20;
    resetLabel.cursorOverStyle = am4core.MouseCursorStyle.pointer;
    resetLabel.hide();
    resetLabel.events.on('hit', function(ev) {
      resetLabel.hide();
      ev.target.baseSprite.titles.getIndex(0).text = &quot;Yearly Data&quot;;
      ev.target.baseSprite.data = chartData;
    });
  
    series.columns.template.events.on(&quot;hit&quot;, function(ev) {
      if ('object' === typeof ev.target.dataItem.dataContext.months) {
        // update the chart title
        ev.target.baseSprite.titles.getIndex(0).text = ev.target.dataItem.dataContext.category + ' monthly data';
        // set the monthly data for the clicked month
        ev.target.baseSprite.data = ev.target.dataItem.dataContext.months
        resetLabel.show();
      }
    }, this);
  });
  </code></pre>
  <p><strong>HTML</strong>:</p>
  <pre><code>&lt;body&gt;
      &lt;div class=&quot;titel&quot;&gt;
          &lt;p&gt; Title&lt;/p&gt;
      &lt;/div&gt;
      &lt;script src=&quot;https://www.cdn.amcharts.com/lib/4/core.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
      &lt;script src=&quot;https://www.cdn.amcharts.com/lib/4/index.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
      &lt;script src=&quot;https://www.cdn.amcharts.com/lib/4/themes/animated.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
      &lt;script type=&quot;text/javascript&quot; src=&quot;./test_drill_down.js&quot;&gt;&lt;/script&gt;
      &lt;div id=&quot;chartdiv&quot;&gt; &lt;/div&gt;
      &lt;link href=&quot;style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>But I do not understand why I get this error, the modules are loaded before the javascript chart script. I am using the same HTML file as I used in other graphs, and there it did work properly.</p>
  <p>What am I doing wrong?</p>