Python 2 compatible: exec "some statement" in globals_dict, locals_dict Python 2 and 3 compatible: exec("some statement", globals_dict, locals_dict)