This question already has an answer here:
- Use 'import module' or 'from module import'? 13 answers
In Python, I'm not really clear on the difference between the following two lines of code:
import X
or
from X import *
Don't they both just import everything from the module X? What's the difference?
Let's use this as an example of our module definition
the from import will pull everything into the current namespace
the normal import will create a module object called X in the current namespace
in addition with from X import my_func can be used to only import that functionality.