boolean (@NotNull PyClass cls, @NotNull String name) { final Scope scope = ControlFlowCache.getScope(cls); if (!scope.getNamedElements(name, false).isEmpty()) return true; return StreamEx .of(scope.getImportedNameDefiners()) .select(PyImportElement.class) .anyMatch(e -> name.equals(e.getVisibleName())); }