Variations on Import
from
module
import
This imports selective symbols from a module into the current namespace
from spam import foo, bar foo() # No longer need module prefix
Or you can import all of the symbols into the current namespace
from spam import *
Note: But this does not import symbols starting with an underscore (_)
reload
module
This reloads a module. For example:
reload spam
Useful for debugging, but somewhat problematic if you aren't careful.
References to classes and other objects in the old module are not updated.
Generally doesn't work with extension modules (written in C).
<<<
O'Reilly OSCON 2000, Introduction to Python, Slide 105
July 17, 2000, beazley@cs.uchicago.edu
>>>