Goal: I have never done this before, and am new to python. I want to run a python script on call as a button is pushed.
Question: Can someone give pointers as to how to go about solving this?
My Code:
**Button HTML**
# Layout of Dash App HTML
app.layout = html.Div(
children=[
html.Div(
html.Button('Detect', id='button'),
html.Div(id='output-container-button',
children='Hit the button to update.')
],
),
],
)
@app.callback(
dash.dependencies.Output('output-container-button', 'children'),
[dash.dependencies.Input('button')])
def run_script_onClick():
return os.system('python /Users/ME/Desktop/DSP_Frontend/Pipeline/Pipeline_Dynamic.py')
Currently this gives the error:
Traceback (most recent call last):
File "app.py", line 592, in <module>
[dash.dependencies.Input('button')])
TypeError: __init__() missing 1 required positional argument: 'component_property'
EDIT:
I think the solution might be to add some_argument to the run_script_onClick:
def run_script_onClick(some_argument):
return os.system('python /Users/ME/Desktop/DSP_Frontend/Pipeline/Pipeline_Dynamic.py')
I am currently browsing through this list to find an appropriate item() to use as argument.