I am loading an IronPython script from a database and executing it.  This works fine for simple scripts, but imports are a problem.  How can I intercept these import calls and then load the appropriate scripts from the database?
EDIT:  My main application is written in C# and I'd like to intercept the calls on the C# side without editing the Python scripts.
EDIT: From the research I've done, it looks like creating your own PlatformAdaptationLayer is the way you're supposed to to implement this, but it doesn't work in this case.  I've created my own PAL and in my testing, my FileExsists method gets called for every import in the script.  But for some reason it never calls any overload of the OpenInputFileStream method.  Digging through the IronPython source, once FileExists returns true, it tries to locate the file itself on the path.  So this looks like a dead end.
You can re-direct all I/O to the database using the PlatformAdaptationLayer.  To do this you'll need to implement a ScriptHost which provides the PAL.  Then when you create the ScriptRuntime you set the HostType to your host type and it'll be used for the runtime.  On the PAL you then override OpenInputFileStream and return a stream object which has the content from the database (you could just use a MemoryStream here after reading from the DB).  
If you want to still provide access to file I/O you can always fall back to FileStream's for "files" you can't find.
Custom IronPython import resolution