Hi ! I created an Add-in project using the ArcGIS Pro SDK for .NET (C#) and now I'm trying to call the Add-in methods from my Python scripts using ArcPy but I didn't find neither documentation nor examples how to achieve this, I've tried some things however it didn't work and now I'm stuck... So I'm wondering if someone knows or has any ideas how to do this ?
What type of functionality is in your C# code that you would like to call from Python?
A more typical code pattern would be to have C# code call Python using the Geoprocessing API as demonstrated in this sample:
Actually all our production line is based on ArcPy scripts, however we’re using ArcGIS Pro SDK for .Net (C#) for one specific functionality that can’t be done with ArcPy: export the annotations baselines (the polylines not the bounding box polygons) into a new Feature Class, that’s why we need to call C# code from Python.
So the functionalities that have been implemented in C# are:
Would you have any idea how we could accomplish this?
Thank you for your attention to this matter. Best regards.
Currently there's no way to call an ArcGIS Pro SDK Add-In from a python script.
So, I implemented a workaround: I created a Console Application, which will be called from a python script, like an entry-point.
Note: This workaround only works if you're working with "ArcGIS.Core" and "ArcGIS.Corehost" assemblies, it crashes for all the other assemblies (ArcGIS.Desktop.*)
We are now struggling with the same question and we would solve it the same way, as you did, Fabian.
I expected at least to be able to create a C#/.net-GP Tool to call it from python. I cannot understand, why this isn't supported in the Pro SDK.
Also nice would be to enable ArcGIS Pro command search and execution from python script.
It really does not make sense to call Python Script from C#/.net Code. Scripts are used to automate things, C#/.net to implement functions.
I picked this up to hopefully draw other customers and esri's attention to it.
Thanks for this post, Fabian and kind regards