The Boost documentation does not specify this. When I use boost::python::import, where exactly is the specified module imported? My guess would be in '__main__' (just to make sure).
Also, what happens when the module object goes out of scope? Given the wording in Boost’s docs — “Returns: An instance of object which holds a reference to the imported module” — I would guess only the reference goes out of scope, the module object is still found within '__main__' (or wherever it was imported).
The underlying mechanism is
PyImport_ImportModule, and no, it doesn’t touch__main__. Successfully imported modules are inserted intosys.modulesdict, so the object is not freed when you DECREF what the function returns — there is still at least that one reference alive.