I agree with user707650's general guidance, but you can do what you wanted by:
import X,Y,Z
linesfrom dependencies import *
.Your idea didn't work because the interpreter creates a new namespace that's local to the function being executed... so your imports are imported in that namespace, but its separate from yours and furthermore is immediately terminated when the function is complete. You won't ever get anything out from a function apart from whatever's listed in the return
statement.
In other words, this must be done by executing an import statement, not executing a function.