# Import Category class in a component

**URL:** https://meta.discourse.org/t/import-category-class-in-a-component/138406
**Category:** Development
**Created:** [January 12, 2020, 11:50pm UTC](https://meta.discourse.org/t/import-category-class-in-a-component/138406 "2020-01-12T23:50:07Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [January 12, 2020, 11:58pm UTC](https://meta.discourse.org/t/import-category-class-in-a-component/138406/2 "2020-01-12T23:58:52Z")

</div>

> [@rogerco](#):
>
> `import Category from "discourse/models/category";` at the top of the script it barfs saying  
> `SyntaxError: unknown: 'import' and 'export' may only appear at the top level`

You got to use a multi JS file component to get these features see:

> [@Split up theme Javascript into multiple files](https://meta.discourse.org/t/splitting-up-theme-javascript-into-multiple-files/119369):
>
> Complex theme javascript can be split into multiple files, to keep things nicely organised. To use this functionality, simply add files to the /javascripts folder in your theme directory. These files can not be edited from the Discourse UI, so you must use the [Theme CLI](https://meta.discourse.org/t/discourse-theme-cli-console-app-to-help-you-build-themes/82950) or [source the theme from git](https://meta.discourse.org/t/how-to-source-a-theme-from-a-private-git-repository/82584). Javascript files are treated exactly the same as they are in core/plugins, so you should follow the same file/folder structure. Theme files are loaded after core/plugins, so if the filenames match,…

---

_[View the full topic](https://meta.discourse.org/t/import-category-class-in-a-component/138406)._
