title: Setting a widget input using a variable in Databricks
body: <p>Like the question says, I want to know if/how you can set a Databricks widget input using a variable instead of a hard-coded value. I have two notebooks. One needs apply a filter to some values. The other needs to run some code, then optionally (as dictated by another widget) apply that same filter.<br>
  Here's some example code (modified for simplicity/privacy).  </p>
  
  <p>In Notebook2 we have:</p>
  
  <pre><code>start = dbutils.widgets.get("startDate")
  filter_condition = None
  if start:
    filter_condition = f"GeneratedDate &gt;= '{start}'"
  
  foo = important_function(filter_condition)
  </code></pre>
  
  <pre><code>%run ./Notebook1 $run_training="True" $num_trials=100 $filter_string=filter_condition
  </code></pre>
  
  <p>where I want <code>filter_condition</code> to be the above-defined variable and not a string.  </p>
  
  <p>In Notebook1, there's some code like:</p>
  
  <pre><code>if run_training=="True":
    bar = optimize_model(datasets, grid, int(num_trials))
  elif run_training=="False":
    baz = apply_filter(filter_string)
  else:
    # Throw error
  </code></pre>