Exec() scope in a callback

Hi All

I have a problem to access variable created wth a callback but executed with python exec() command. I pass the globals() dictionary and the locals() dictionary to the exec() fonction, but get a KeyError when a try to access a variable created during the execution. I get the KeyError even if look for this variable in the globals() dictionary or the locals() dictionary. i reasonably think that I should find the created variable in the local dictionary.
Here is an extract of the code


image = Image.open(figfile)
output = html.Img(src=image, width=600, height=1200)
… , globals(), locals())

dict_locals = locals()
output = dict_locals[‘output’]
return output

The fact is that when I execute similar code outside a dash application, it runs fine.

Thanks for a help/