ProcessDebugger (@NotNull String threadId) { ProcessDebugger debugger = myThreadRegistry.getDebugger(threadId); if (debugger != null) { return debugger; } else { // thread is not found in registry - lets search for it in attached debuggers List<RemoteDebugger> debuggers = getDebuggers(); for (ProcessDebugger d : debuggers) { for (PyThreadInfo thread : d.getThreads()) { if (threadId.equals(thread.getId())) { return d; } } } //if not found then return main debugger return debuggers.get(0); } }