I am building a large storage network wherein I would like to have a function which takes in a text value and returns a canister.
Equivalently, I need a way to dynamically import a canister and save it as a variable.
What I have in mind is something like:
import Mystoragecanister "canister:mystoragecanister";
actor{
func getcanister(canistername: Text) : Canister {
return Mystoragecanister;
};
};
Of course this does not work and the error I get is: “type error [M0029], unbound type Canister.”
So, how can I dynamically import Canisters with Motoko?
Thanks in advance!