Urgent!- Dash dcc upload cant return the full path of file or directory , using tkinter in dash works with threading problem

hi, i am stucking on this issue a long time -
i need a button that open file dialog to choose folder, and i must get back the full directory path
as i understand its not possible to get the full path with dcc. upload
so i try to use tkinter - filedialog.askdirectory() from the Dash button callback
first, i got error that “main thread isnt in main loop”
and i understand that i have to run the tkinter in differnrt thread or process
so i tried it, it is work but bad:(
it is really open the filedialog and got the directory but some strange things happen sometimes its stuck the application sometimes after few actions in the Dash app, i cant click again at the button at all

please see my code:

def open_folder(q):
root = Tk()
root.withdraw()
folder_path = filedialog.askdirectory()
q.put(folder_path)

@callback(
Output(‘obj_params_tbl’, ‘rowTransactions’),
Output(‘wf_error_massage’, ‘show’),
Output(‘wf_error_massage’, ‘message’),
Output(‘wf_error_massage’, ‘toastRole’),
Input(‘add_wf_btn’, ‘n_clicks’),
State(‘obj_params_tbl’, ‘rowData’)
)
def add_wf(n_clicks, current_data):
if n_clicks:
folder_path = None
q = mp.Queue()
p = mp.Process(target=open_folder, args=(q,), daemon=True)
p.start()
folder_path = q.get()
if folder_path:
wf_folders_results, massage = search_for_wf_folders(folder_path, [p[‘path’] for p in current_data])
if wf_folders_results is None:
return no_update, True, massage, ‘error’
for path in wf_folders_results:
oc.objective_params_row_data[oc.selected_objective_id].append({‘path’: path})
return oc.objective_params_row_data[oc.selected_objective_id], True, massage, ‘success’
return no_update, True, ‘Add WF could not get folder path’, ‘error’
return no_update, False, None, None