Skip to content

You can download the code of this step here or all the steps here.

Step 2: Basic functions

Let's discuss some of the essential functions that come along with Taipy.

Utility of having scenarios

Taipy lets the user create multiple instances of the same configuration. Data can differ between different scenario instances. It is essential to detect/understand the difference in data between scenario instances: e.g., comparing the output/results of different instances... Such differences in behavior between different scenarios entities (from the same scenario configuration) can be due to the following:

  • Changing data from input data nodes,

  • Randomness in a task (random algorithm),

  • Different values from parameters set by the end-user, etc.

The developer can directly change the data nodes entities with the write function (see below).

scenario = tp.create_scenario(scenario_cfg, name="Scenario")
print("Output of First submit:",


[2022-12-22 16:20:02,874][Taipy][INFO] job JOB_double_a5ecfa4d-1963-4776-8f68-0859d22970b9 is completed.
Output of First submit: 42

write function

Data of a Data Node can be changed using write. The syntax is <Scenario>.<Pipeline>.<Data Node>.write(value). If the scenario contains a single pipeline, we can write <Scenario>.<Data Node>.write(value).

print("Before write",
print("After write",


Before write 21
After write 54

The submission of the scenario will update the output values.

print("Second submit",
[2022-12-22 16:20:03,011][Taipy][INFO] job JOB_double_7eee213f-062c-4d67-b0f8-4b54c04e45e7 is completed.
Second submit 108

Other useful functions

  • tp.get_scenarios accesses all the scenarios by returning a list.
print([ for s in tp.get_scenarios()])



  • Get an entity from its id:
scenario = tp.get(
  • Delete an entity through its id. For example, to delete a scenario: