def import_global_module(module, current_locals, current_globals, exceptions=None):
 try:
  objects = getattr(module, '__all__', dir(module))
  for k in objects:
   if (k and (k[0] != '_')):
    current_globals[k] = getattr(module, k)
 except exceptions as e:
  return e
 finally:
  del current_globals, current_locals

def import_global_module ( module , current_locals , current_globals , exceptions = None ) : try : objects = getattr ( module , '__all__' , dir ( module ) ) for k in objects : if ( k and ( k [ 0 ] != '_' ) ) : current_globals [ k ] = getattr ( module , k ) except exceptions as e : return e finally : del current_globals , current_locals
import the requested module into the global scope warning! this will import your module into the global scope **example**: from django .