Use document->cached in the Python scripting backend