runpy

runpy.py - locating and running Python code using the module namespace

Provides support for locating and running Python scripts using the Python module namespace instead of the native filesystem.

This allows Python code to play nicely with non-filesystem based PEP 302 importers when locating support scripts as well as when importing modules.

Functions

get_loader(module_or_name) Get a PEP 302 “loader” object for module_or_name
read_code(stream)
run_module(mod_name[, init_globals, ...]) Execute a module’s code without importing it
run_path(path_name[, init_globals, run_name]) Execute code located at the specified filesystem location