Dynamically importing canisters with Motoko

I think I can adapt this answer Programmatic import in Motoko - #3 by gilbert to solve my problem. Basically, creating a type in the format if your actor and then creating a function that outputs that type should do the trick (as long as all your canisters you wish to choose from to return are of the same type).

If it works, I will post again and let you all know.

Update: This solution works like a charm!