This can be done using the option -i. Quoting translator help text:
-i: inspect interactively after running script; forces a prompt even
if stdin does not appear to be a terminal; also PYTHONINSPECT=x
, script, .
:
$ python -i boilerplate.py
>>> print mymodule.__doc__
I'm a module!
>>>
, PYTHONSTARTUP. :
$ PYTHONSTARTUP=boilerplate.py python
Python 2.7.3 (default, Sep 4 2012, 10:30:34)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print mymodule.__doc__
I'm a module!
>>>
, , .