Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

python add custom code to startup

patrick_digan
17 - Castor
17 - Castor

How can I customize the code that appears when I drop a new python tool onto the canvas? I found the startup directory (%USERPROFILE%\.ipython\profile_default\startup) and can add code in the background successfully. However, my workflow then wouldn't work on somebody's else's machine who isn't also loading those libraries via a startup command; instead, I would like to add items to the startup on the screen (ie not in the background). So after importing the Alteryx library in the picture below, I want to import pandas (without having to type it in every time). What file can I adjust to make that happen by default?

Capture.PNG

2 REPLIES 2
Claje
14 - Magnetar

Hi,

 

I didn't look up where this goes in the user/non-admin install (although i assume its the same basic directory), but you can modify this from the Alteryx install folder in the .\bin\htmlplugins\jupytercode\ directory.

 

There's a file there called "initWorkbook.ipynb", which includes the starting workbook code.  I only did a small amount of testing, but I was able to tweak the initial config of

"from ayx import Alteryx\n\n"

 

to

 

"from ayx import Alteryx\nimport pandas\n\n" and it appeared correctly in Alteryx when I initialized a new Python tool.

patrick_digan
17 - Castor
17 - Castor

@Claje that's perfect thanks!

Labels