Visual Application: Call Python code in JavaScript

sbackmann Registered Posts: 2 ✭✭✭


In order to edit a project variable in a visual application, I want to create a search box with auto suggestions. I managed to create Select boxes for variables with this Python Code:

import dataikudef do(payload, config, plugin_config, inputs):countries = dataiku.Dataset("Countries").get_dataframe()choices = []for val in countries['Land'].unique():choices.append({"value": val, "label": val})return {"choices": choices}

I can also create a search box with suggestions in JavaScript where the possible choices are hardcoded. I struggle however to populate the choices for the suggestions from a dataset, similar to the above Python code. I studied the example here but it doesn't become quite clear to me how to integrate callPythonDo() into the JavaScript code.

Thanks for any help.

Operating system used: MacOS Monterey 12.1

Setup Info
      Help me…