when we use exec to run python code from a text file, the locals and globals inside the exec are lost.
so w = QWidget() will instantly be garbage collected.
How can we keep the reference?
tried but no luck so far
exec(self._command, globals(), globals())
it seems to pass the var correctly but widget still garbage collected.
testing with import buttonizer.main; global w; w = buttonizer.main.show()
when we use
exec
to run python code from a text file, the locals and globals inside the exec are lost. sow = QWidget()
will instantly be garbage collected.How can we keep the reference? tried but no luck so far
it seems to pass the var correctly but widget still garbage collected. testing with
import buttonizer.main; global w; w = buttonizer.main.show()
see https://www.programiz.com/python-programming/methods/built-in/exec