An instance of AlteryxEngine gets passed to the pi_init() method. Also from the sdk docs, it indicates that you can't create your own AlteryxEngine instance. However, in a workflow that has multiple copies of my Python tool, I can see that each instance of my AyxPlugin class gets an AlteryxEngine object that points to a unique memory address. Does this need to be the case? This doesn't appear to be the way the AlteryxEngine class is meant to work because many of its methods require a tool_id. If it can be shared, it would be nice if there was just a global variable in the AlteryxPythonSDK module that had the instance of the global AlteryxEngine.
Also is there documentation on what possible values are for get_init_var()? I found an API reference in the CHM files that ship with the C# SDK but in some of the Python tool examples there is use of 'UpdateOnly' var that is not mentioned at all in these docs.
Solved! Go to Solution.
In actuality, the AlteryxEngine PyObject is a wrapper class to a global AlteryxEngine. So, although each plugin has a unique AlteryxEngine PyObject instance, they all reference the same global instance of an AlteryxEngine object.
I do not have documentation for the possible values of get_init_var(), but I can help you with the use of 'UpdateOnly'. The 'UpdateOnly' init var indicates if the workflow is being invoked in an 'UpdateOnly' mode or an 'Execution' mode. If a user changes the configuration for a tool in the workflow it will run the workflow in 'UpdateOnly' mode to allow tools to update any configuration changes and throw any configuration errors that can be detected before actual 'Execution' of the workflow.
This page has a list of variables for get_init_var(): https://help.alteryx.com/developer/current/index.htm#Python/use/AlteryxEngineClass.htm