As a follow up to this question: How to pickle a python function with its dependencies?
What is a good approach for determining a method's dependencies? For instance, similar to the above post, if I have a function f that uses methods g and y is there an easy way to get a reference to g and y dynamically?
Further, I guess you would want this method to recurse down the entire function graph such that if y depended on z you could also bundle up z.
I see that disco uses the following module for this: https://github.com/discoproject/disco/blob/master/lib/disco/worker/classic/modutil.py
Any other suggestions on how to tackle this? The disco approach seems to be module based so you potentially have to bundle up more than you need to actually execute the root method.