Calling another canister's methods

You can follow the second approach above, use the canister id shown in the terminal when you deployed the canister2 project.

If you don’t want to pass the id in you can also hard code it, like this: https://forum.dfinity.org/t/how-to-use-cowsay-project-in-my-project/6473/2?u=ori

In your local dev environment, if you need to start clean then deploying projects in the same order every time will ensure the assigned canister id doesn’t change.

(For your production deployment, note the mainnet canister id will be different to the locally deployed one so you’ll have to account for that.)

1 Like