Manage controllers using motoko

Hello people. I am designing a system in which there is a “Main” canister with a public function that generates another “Child” canister. According to my observations the Principal of the Main canister will be the controller of the Child canister. The question is, how can I do, within the same function that creates the “Child” canister, so that the Main canister establishes the Principal of the function caller as controller, and also removes itself as controller. I would also like to know which library I should use to update, stop, check balance, etc. of another canister for which my canister is the controller, through the frontend of a canister. Thank you!!

1 Like

hey, you can use update_settings method of IC Management canister to update controllers of child canister as soon as you created a new one from parent canister.
IC Management canister has different methods, to stop and update canisters by controller.