what is the point of this?
you can just import inside function definitions:
def antislash(A, b):
from numpy.linalg import solve
return solve(A, b)
thus numpy.linalg is only imported the first time you call the antislash function. Much cleaner than a global import.Ignore wrong traditions. Put all imports in the innermost scopes of your code!