I have been trying to run python interactively from within sublime text 2.
I have tried what was suggested in this thread: Running Python interactively from within Sublime Text 2
import sublime, sublime_plugin
class PydevCommand(sublime_plugin.WindowCommand):
    def run(self):
        self.window.run_command('set_layout', {"cols":[0.0, 1.0], "rows":[0.0, 0.5, 1.0], "cells":[[0, 0, 1, 1], [0, 1, 1, 2]]})
        self.window.run_command('repl_open',{"type": "subprocess",
                                             "encoding": "utf8",
                                             "cmd": ["python2.7", "-i", "-u", "$file"],
                                             "cwd": "$file_path",
                                             "syntax": "Packages/Python/Python.tmLanguage",
                                             "external_id": "python2.7"
                                             })
        self.window.run_command('move_to_group', { "group": 1 }) 
and using the key binding:
{"keys": ["f5"], "command": "pydev"}
However, this works but gives me and error as I then can't get to my python modules.
This is the build I have running and this works fine, however it always exits before I can use interactive mode.
{
    "cmd": ["python", "-ui", "$file"],
    "path": "/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin",
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}
Thanks in advance for reading this!