# python


04/04/2019, 9:36 PM
folks? my previous question. anyone, please?


04/04/2019, 9:38 PM
no - we don’t have any way right now for you to hook into object lifecycles in that manner, unfortunately.


04/05/2019, 5:22 AM
This relates to the “dynamic provider” that TS/JS has but Python doesn’t. One possibility is to register callbacks with the provider to run, but from what I can tell, the provider is running in a different python process than the user code. @incalculable-sundown-82514 correct me if I’m wrong, but my understanding is that the user code runs in an async function called by the constructor of the Stack object. While it runs, each call to a pulumi resource registers an RPC with the engine. The RPCs call the provider, which awaits each of the inputs. As each of the resource’s inputs resolve, the RPC completes. When all the RPCs have completed, the run has completed. So to hook in with the provider, we’d have to provide code that was not bound to any of the user variables, but could be bound to the RPC inputs/outputs.
The only way I’ve seen to “clean up” something that an “up” created and then was removed from the code is to delete it and then “pulumi refresh”.