See this add-on on the kodi.tv showcase
See here for details: http://pydev.org/manual_adv_remote_debugger.html