# \`import actor MyLib.MyActor\` fails

**URL:** <https://forums.swift.org/t/import-actor-mylib-myactor-fails/72055>\
**Category:** Using Swift\
**Tags:** import, actors\
**Created:** [May 24, 2024, 2:50pm UTC](https://forums.swift.org/t/import-actor-mylib-myactor-fails/72055 "2024-05-24T14:50:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjatie](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jjatie/32/24428_2.png) [@jjatie](https://forums.swift.org/u/jjatie)\
**Post date:** [May 24, 2024, 2:50pm UTC](https://forums.swift.org/t/import-actor-mylib-myactor-fails/72055/1 "2024-05-24T14:50:41Z")

</div>

With enums, structs, classes, protocols, and typealiases, you can explicitly import a type like so:

```swift
import enum MyLib.MyEnum
import struct MyLib.MyStruct
import class MyLib.MyClass
import protocol MyLib.MyProtocol
import typealias MyLib.MyTypealias

```

however this does not work for actors:

```swift
import actor MyLib.MyActor
// 3 compiler errors arise:
// 1. Consecutive statements on a line must be separated by ';'
// 2.Expressions are not allowed at the top level
// 3. No such module 'actor'

```

Is this just an oversight? Is it fine to import as a class?

---

<div class="post-metadata">

**Author:** ![jamieQ](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jamieq/32/5117_2.png) [@jamieQ](https://forums.swift.org/u/jamieQ)\
**Post date:** [May 25, 2024, 5:39pm UTC](https://forums.swift.org/t/import-actor-mylib-myactor-fails/72055/2 "2024-05-25T17:39:49Z")

</div>

this seems like it's probably an oversight, but it appears using the `class` syntax with an actor symbol works. i would suggest filing a [bug](https://github.com/apple/swift/issues/new?assignees=&labels=bug%2Ctriage+needed&projects=&template=bug-report.yml) if you have the time.
