OK, so I know that from-import
is "exactly" the same as import
, except that it's obviously not because namespaces are populated differently.
My question is primarily motivated because I have a utils
module which has one or two functions that are used by every other module in my app, and I'm working on incorporating the standard library logging
module, which as far as I can tell I need to do sorta like this:
import logging
logging.basicConfig(filename="/var/log") # I want file logging
baselogger = logging.getLogger("mine")
#do some customizations to baselogger
and then to use it in a different module I would import logging again:
import logging
logger = logging.getlogger("mine")
# log stuff
But what I want to know is if I do a from utils import awesome_func
will my logger definitely be set up, and will the logging module be set up the way I want?
This would apply to other generic set-ups as well.