How to import an ic deployed canister in my project so it works with local deployment?

Your local dev environment runs its own replica which doesn’t call out to the main network, so for now the solution is to deploy a version of the remote canister (or a mock canister with matching interface) locally and interact with that using the actor(“<canister_id>”) format.

Note it’ll get assigned a different canister id, shown in the terminal output when deploying, so you’ll need to use that id locally.

Some related details here:
https://forum.dfinity.org/t/calling-another-canisters-methods/473/5?u=ori
And
https://forum.dfinity.org/t/how-to-use-cowsay-project-in-my-project/6473/3?u=ori

2 Likes