I have a script that requires a user's input in Jupyter. The script is similar to the famous tic tac toe python game, where a user inputs a location on the board, the script waits for an input and continues. Unfortunately, DataBricks doesn't seem to have input(), but it does have widgets. However, widgets don't seem to wait for input and therefore, my script fails. Is there a way to use widgets in DataBricks and have my script wait for user input before proceeding, like input()?
For example,
for i in range(2):
name = input("Enter name: ")
print(f"Name is {name}")
results in a loop that waits for user input.
The equivalent in DataBricks should be
for i in range(2):
dbutils.widgets.text("name", "")
name = dbutils.widgets.get("name")
print(f"Name is {name}")
results in
Name is
Name is
because the loop never pauses to allow user input.