I am trying to write my own functions/methods in a tools.py module for an ongoing project.
I need to import some modules like numpy for these methods, but am unsure of the best way to do this. Should I import within each method each time I call that function? Or in the tools.py script at the beginning? I do not always need all the functions in tools.py, and for example, don't always need numpy in the script where I call import tools
. I would like my code to be as efficient as possible.
I only found info that I need not import numpy if I do not call it directly in a specific script.