Using variables returned from an export function

It would be really nice if you attached the screenshot with the error so I can better debug. I have no way of testing the code, so it is really necessary.

PS: I edited my answer for better error avoidance and checking.