The second method you describe sounds like it is along the lines of what I need to do. Is there a way to do this using the Python/C API? For instance, if I have the contents of a pyc file loaded entirely into memory, and I have a pointer to the beginning of the file and the size in bytes at my disposal, can I import that by any means?