If I have a function that requires an import and said function is itself imported, what is the preferred operation?
Would you have the function do the import, or would you have a try/except in said function to inform the user that the custom function has a missing dependency that needs to be imported?
You cannot import functions only modules.
The module would include the imports for the code it contains I assume.
Then the user of the module does not need to care if the function needs imports as it taken care of.
One can do from mod import func so it looks like only func is imported, but indeed, the entire module is imported and added to sys.modules before binding 'func' to the function in mod.
Rob, import dependency in func’s module either at the top or possibly in the function.