'Motoko Upgrade Actor Class Canister

I am utilizing actor classes within my motoko app that are created dynamically. How do I upgrade those canisters using dfx.

When using dfx deploy it only upgrades the static actor canisters, not any of my dynamically created actor classes.

Update 1:

I have found the IC management canister can install new code on other canisters with webassembly bytes, but am unsure how to get that new code to update the actor class instances

What is the proper way of rolling out updates to all dynamically created actor classes that are deployed already?

Example

Main.mo

import A "ActorClass";
import Array "mo:base/Array";
import Cycles "mo:base/ExperimentalCycles";


actor MainCanister {

    var created_canisters : [A.ActorClass] = [];

    public func create_player() : async A.ActorClass {
        let canister : A.ActorClass = await A.ActorClass();
        created_canisters := Array.append(created_canisters, [canister]);
        return canister;
    };
};

ActorClass.mo

actor class ActorClass() {

}

Step 1: Deploy

MainCainster is installed as expected

Step 2: Call create_player func

A instance/canister of ActorClass is created

Step 3: Update ActorClass with new/changed functionality

Step 4: Re-Deploy

ONLY MainCanister is updated, not any ActorClass instance




Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source