def loaded_vispy_modules(import_module, depth=None, all_modules=False):
 vispy_dir = os.path.dirname(os.path.dirname(vispy.__file__))
 code = ("import sys, %s; print(', '.join(sys.modules))" % import_module)
 res = run_subprocess([sys.executable, '-c', code], cwd=vispy_dir)[0]
 loaded_modules = [name.strip() for name in res.split(',')]
 if all_modules:
  return loaded_modules
 vispy_modules = set()
 for m in loaded_modules:
  if (m.startswith('vispy') and ('__future__' not in m)):
   if depth:
    parts = m.split('.')
    m = '.'.join(parts[:depth])
   vispy_modules.add(m)
 return vispy_modules

def loaded_vispy_modules ( import_module , depth = None , all_modules = False ) : vispy_dir = os . path . dirname ( os . path . dirname ( vispy . __file__ ) ) code = ( "import sys, %s; print(', '.join(sys.modules))" % import_module ) res = run_subprocess ( [ sys . executable , '-c' , code ] , cwd = vispy_dir ) [ 0 ] loaded_modules = [ name . strip ( ) for name in res . split ( ',' ) ] if all_modules : return loaded_modules vispy_modules = set ( ) for m in loaded_modules : if ( m . startswith ( 'vispy' ) and ( '__future__' not in m ) ) : if depth : parts = m . split ( '.' ) m = '.' . join ( parts [ : depth ] ) vispy_modules . add ( m ) return vispy_modules
import the given module in subprocess and return loaded modules import a certain module in a clean subprocess and return the vispy modules that are subsequently loaded .