Note that this has changed in IPython-0.11. Instead of what is described below, just use the following import:
from IPython import embed as shell
Below is the answer for IPython versions prior to 0.11.
In the area where you want to switch to ipython, define this
def start_ipython():
from IPython.Shell import IPShellEmbed
shell = IPShellEmbed()
shell()
start_ipython, .
locals() .
,
def start_python():
import code
code.interact()
. . ipython, ImportError, , , ipython .