The pyCharm remote debug import has to been after the debug is started from pyCharm. Otherwise the imprt will fail and the next call to the function will freeze the application.
To restart the debug session the active session has to be stoped from pyCharm. Only then can the connecrion function be called again. If the function is called a second time in the same debug session, Revit will freeze

