How to properly interact with Actor Classes?

I have been looking at the (Actor Classes)[Untitled :: Internet Computer] guide in the SDK and trying to implement my own basic example but have difficulties interacting with it.

My basic project consists of two files, ‘’ and in the same folder ‘’.

import testclass "testclass";

actor {
    public func greet(name : Text) : async Text {
        return "Hello, " # name # "!";
    public func test() : async Text {
        let thisclass = testclass.Hello();
        return await;


actor class Hello(){
    public func run(): async Text {
        return "Hello World 12345!";

The problem I have us that I get a build error on the return line of the test() function in the ‘’ file.

type or paste code here

I posted too early sorry so I will add the type error I received here:

After using dfx deploy:
Stderr: /home/sg/Documents/Programming/DFINITY/test_classes/src/test_classes/ type error [M0070], expected object type, but expression produces type async<$test> Hello

This is how the build error appeared inside of VS Code.

The way I understand how to use an actor class is like an object.
Here I take an instance of it by calling let thisclass = testclass.Hello(); and then expect to use the run() function by calling await;.

Thanks for your help :slight_smile:

1 Like

Based on the error message it looks like you might need to await the class constructor as well:

let thisclass = await testclass.Hello();
1 Like

Thank you so much, that fixed the issue!

I need to improve my understanding of asynchronous method calls.