Im using Ipywidgets in a jupytor notbook in VScode. When making a interface i use a .py file to code an load this into the notbook. This looks like the following
import Moduals.TestFile as File
display(File.button)
This works fine until I need to reload the cell in the notebook. After doing this, the .observe or .on_click don't register any input. After the kernel is reloaded, the functions work again until you reload the cell without reloading the kernel.
I expected the .observe to work the second time, but even after resetting all global variables, the problem still persists. I suspect that the button might be renamed because the same occurs when using the code from the test file in a notebook and display(button) is in a second cell. If the first cell is reloaded, the button is not recognized until I rerun the second cell. But then I don't understand why this is not resolved by resetting the global variables.
Im using Ipywidgets in a jupytor notbook in VScode. When making a interface i use a .py file to code an load this into the notbook. This looks like the following
where the testfile looks as follows
This works fine until I need to reload the cell in the notebook. After doing this, the .observe or .on_click don't register any input. After the kernel is reloaded, the functions work again until you reload the cell without reloading the kernel.
I expected the .observe to work the second time, but even after resetting all global variables, the problem still persists. I suspect that the button might be renamed because the same occurs when using the code from the test file in a notebook and display(button) is in a second cell. If the first cell is reloaded, the button is not recognized until I rerun the second cell. But then I don't understand why this is not resolved by resetting the global variables.