doing this in the exec block of input_widget.py seems to work, at least for my example above
I’m not sure if I should update the eval block as well.
I can probably clean this up and submit a pull request.
d = dict(globals(), **self._locals)
exec(python_code, d, d)
d2 = dict(globals(), **self._locals)
for k in d:
if (k in d2 and d2[k] != d[k]) or k not in d2:
self._locals[k] = d[k]