TCanvas

Hello,
I have some problems with canvas. I call the function pyScan from my main. In this function I analyse my data and I build an histogram inside a canvas. Then I build a python dictionary in which I save the canvas and other things. Finally I return this dictionary to my main. Now, if I call this function just one time everything works well, but if I call it more than one time problems appear. It seems that the second time in the main function the canvas is not more a canvas. If I print the canvas-type in the function pyScan exactly before return it is a TCanvas (also the second time) while in the main it is (from the second time) a ‘PyROOT_NoneType’. How is it possible? How can I do to avoid this thing?
Notice that every time the canvas have a different name.
Thanks a lot,
Barbara

Barbara,

the canvas is being deleted by something on the C++ side, which causes the reference to be reset. The most likely cause would be that the name of the canvas is re-used, but like you say. that’s not it. Could you post some code?

Cheers,
Wim