The python API is a useful tool to extend Anchorpoint and communicate with Anchorpoint from other applications. We offer 2 modules which perform different tasks.
The apsync module is a standalone python module that can be used in Anchorpoint Actions as well as in other applications (if they support python) to exchange data and information between Anchorpoint and the server. Use apsync for example to:
The anchorpoint module is an embedded python module which is only available in Anchorpoint Actions. It is the interface to the Anchorpoint Desktop client to extend it e.g. with own dialogs and actions or to query certain states like the currently selected files.
Working with Visual Studio Code#
When working with python scripts it is highly recommended to use a python IDE (integrated development environment) such as the excellent and free Visual Studio Code. VSCode offers an impressive amount of powerful extensions that simplify working with Anchorpoint’s python API. After installing VSCode, we recommend you install the python extension from Microsoft.
After that we need to tell VSCode were to find the python interpreter of Anchorpoint. Click Ctrl+Shift+P and type “Python: Select Interpreter”. Click “Enter interpreter path” and provide the path to the python.exe (windows only): %APPDATA%/../Local/Anchorpoint/python.exe
Alternatively, you can install the apsync module for your local interpreter. Just copy the apsync module to your site-packages folder of your interpreter. You can find the apsync module here:
On windows: %APPDATA%/../Local/Anchorpoint/app-latestversion/plugins/python/Lib/site-packages/apsync
On mac: /Applications/Anchorpoint.app/Contents/Resources/python/lib/python3.9/site-packages/apsync
Now, you should be able to get a fully integrated documentation and auto completion for the anchorpoint and the apsync python module as well as the Anchorpoint pre-installed extensions such as PySide2:
Please note that VSCode will continue to complain “Import “anchorpoint” could not be resolved”. This is due to the fact that the anchorpoint python module is embedded and not a standalone python extension. That being said, the auto completion engine of VSCode will still work as expected.