I have a module lib that needs numpy. So, for instance, let\'s say I have a hypothetical function that looks like
import numpy
def doS
You don't need to do anything to achieve this.
If you do
from lib import doSomething
from lib_with_autograd import doSomething as doSomethingAutograd
each of those functions uses the numpy imported in their specific module. So doSomethingAutograd uses the one imported in lib_with_autograd and doSomething uses the one imported in lib