Trying to install an instance of an actor class, but getting an error message. Anyone know what I'm doing wrong?

Here is the code and the error message that I’m getting. The “Journal” actor class was successfully imported, but when I go to instantiate, I’m getting the following error.

I can’t see the definition of Journal in the screen shot, but judging from the error message, it looks as if it was a plain actor, not an actor class.

1 Like

this is how I defined the Journal actor class.

and this is how I imported it.

Ah, try removing the canister: prefix from the import URI, or use mo: (and replace the call to Journal with Journal.Journal, since the imported file is treated as a module).

Explanation: If you use canister:, you are not importing it as Motoko source, but as a compiled, foreign-language canister. It cannot be used as a Motoko actor class that way, only as a plain actor.

See also here and following section.

2 Likes