Why doesn’t an import in an exec in a function work?

How about this:

def test():
    exec (code, globals())
    f()

Leave a Comment