Why can I not change global variables from inside a function, using exec()? It works fine when the assignment statement is outside of exec(). Here is an example of my problem:
>>> myvar = 'test'
>>> def myfunc():
... global myvar
... exec('myvar = "changed!"')
... print(myvar)
...
>>> myfunc()
test
>>> print(myvar)
test