# Error importing plot 0.5

**URL:** <https://talk.observablehq.com/t/error-importing-plot-0-5/6891>\
**Category:** Help\
**Created:** [August 2, 2022, 4:15pm UTC](https://talk.observablehq.com/t/error-importing-plot-0-5/6891 "2022-08-02T16:15:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nirajn123](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/nirajn123/32/6816_2.png) [@nirajn123](https://talk.observablehq.com/u/nirajn123)\
**Post date:** [August 2, 2022, 4:15pm UTC](https://talk.observablehq.com/t/error-importing-plot-0-5/6891/1 "2022-08-02T16:15:29Z")

</div>

I tried out the Plot library on [Codepen.io](http://Codepen.io) and it works great. I am now trying to use the same codebase on my own site but it gives me error on the import statement -

Uncaught SyntaxError: import declarations may only appear at top level of a module

//Here is the import statement which sits at the top of my js file.  
import \* as Plot from “[https://cdn.skypack.dev/@observablehq/plot@0.5](https://cdn.skypack.dev/@observablehq/plot@0.5)”;

Browser is Firefox 103.0.

I tried removing this and adding the script tags to the html page but then I get an error relating to Plot not being defined.

---

<div class="post-metadata">

**Author:** ![mcmcclur](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mcmcclur/32/2364_2.png) [@mcmcclur](https://talk.observablehq.com/u/mcmcclur)\
**Post date:** [August 2, 2022, 4:30pm UTC](https://talk.observablehq.com/t/error-importing-plot-0-5/6891/2 "2022-08-02T16:30:37Z")

</div>

Did you specify your `script` to be a `module`? Here’s a complete webpage that oughtta work:

```
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <script type="module">
      import * as Plot from "https://cdn.skypack.dev/@observablehq/plot@0.5";
      document.body.append(
      Plot.plot({
        marks: [Plot.line([[0, 0],[1, 1]])]
      }));
    </script>
  </head>
  <body></body>
</html>

```

The [GitHub](https://github.com/observablehq/plot) reference is probably the authoritative place to find this kind of information.

---

<div class="post-metadata">

**Author:** ![nirajn123](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/nirajn123/32/6816_2.png) [@nirajn123](https://talk.observablehq.com/u/nirajn123)\
**Post date:** [August 2, 2022, 5:52pm UTC](https://talk.observablehq.com/t/error-importing-plot-0-5/6891/3 "2022-08-02T17:52:21Z")

</div>

Thank you, this does work.
