I'm not really sure what you mean by "with my local thrift packages already imported", but if you want to start an interactive shell with a specific set of symbols already defined in the global namespace, I'd do it in a function, and import
the symbols in there, to avoid polluting the sub-shell with any unwanted symbols from the rest of your code.
For example, if you wanted to start an interactive shell with sys
and os
already imported, then something like this ought to work...
>>> import code
>>> def start_shell():
... import sys, os
... code.interact(local=locals())
...
>>> start_shell()
Python 2.7.4 (default, Apr 19 2013, 18:28:01)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> dir()
['__builtins__', 'os', 'sys']
...noting that sys
and os
are defined, but not code
because it was imported into the global namespace, not the local one.