How to execute a custom recipe from another (custom recipe) inside a plugin

Solved!
Alan_Fustรฉ
Level 3
How to execute a custom recipe from another (custom recipe) inside a plugin
Hi, I'm developing a plugin with two python custom recipes. Is there a way to execute one recipe from the other?

I've defined a function and tried to call it but I always get "non-package" error. I also tried to define the function in a third file and it doesn't work either.



Thanks!
0 Kudos
1 Solution
Clรฉment_Stenac
Hi,

You can't really "call a recipe from another". When you develop a custom recipe in a plugin, you are actually developing a new "type" of recipe. Whereas the only thing that could be called is an "instance" of a recipe, that you don't know about at development time.

It sounds however that what you want to achieve is to share some code between both your recipes, so that common functions don't need to be written twice. This is possible through the "python-lib" folder of the plugin: https://doc.dataiku.com/dss/latest/plugins/reference/other.html#shared-code

View solution in original post

4 Replies
Clรฉment_Stenac
Hi,

You can't really "call a recipe from another". When you develop a custom recipe in a plugin, you are actually developing a new "type" of recipe. Whereas the only thing that could be called is an "instance" of a recipe, that you don't know about at development time.

It sounds however that what you want to achieve is to share some code between both your recipes, so that common functions don't need to be written twice. This is possible through the "python-lib" folder of the plugin: https://doc.dataiku.com/dss/latest/plugins/reference/other.html#shared-code
Alan_Fustรฉ
Level 3
Author
Thanks!
0 Kudos
Erlebacher
Level 4

Is it possible to access the pylon-lib folder from either vim or an IDE such as PyCharm? I understand how to edit a recipe with an IDE but not python code found under the python-lib/ folder. Thanks.

0 Kudos
ClemenceB
Dataiker

Hi @Erlebacher,

It's now possible with the latest versions of the Pycharm and VSCode extensions.

Best,

Clรฉmence

0 Kudos