You can separate the user interface (UI) from the code logic by using two notebooks.
1) The first notebook will contain the code that performs the actions based on the widget inputs.
2) The second notebook will contain the widgets that users interact with. Use dbutils.widgets
to create the necessary widgets. Use the %run
magic command to call the logic notebook, passing the widget values as parameters.
https://docs.databricks.com/en/notebooks/widgets.html#use-databricks-widgets-with-run