Index: src/org/python/jsr223/PyScriptEngineScope.java =================================================================== --- src/org/python/jsr223/PyScriptEngineScope.java (revision 7173) +++ src/org/python/jsr223/PyScriptEngineScope.java (working copy) @@ -104,7 +104,9 @@ int scope = context.getAttributesScope(key); if (scope == -1) scope = ScriptContext.ENGINE_SCOPE; - context.setAttribute(key, value.__tojava__(Object.class), scope); + context.setAttribute(key, + value instanceof PyType ? value : value.__tojava__(Object.class), + scope); } @ExposedMethod