Import "canister: canistername" error

Try to import canister similar as linkedup demo, but seems it doesn’t work.

By using " import AAA “canister:aaa”; "
then run "dfx build "

it shows:

import error [M0153], file ~/.dfx/local/canisters/idl/r7inp-6aaaa-aaaaa-aaabq-cai.did uses Candid types without corresponding Motoko type

r7inp-6aaaa-aaaaa-aaabq-cai.did:13.11-13.46: import error [M0163], cannot import a Candid service constructor

I had this the other day. Is your canister a class? You can’t import it with canister:. You need to create an actor type that conforms to the actor interface and seed it with a hardcoded principal.

I’m not sure if this corresponds to what you are trying to do, but a motoko actor can directly import and actor class as a library too.

See here for an example

Doc

Code

1 Like

that is exactly the problem! thx a lot~! :smiley:

:+1: :+1: :+1: :+1:

this works also !