This might be a generic OpenGL issue, but just wanted to document it here. The live viewer does not work when called inside a function. You get the error: OpenGL.error.Error: Attempt to retrieve context when no valid context