Use python script tool from .Net ArcGIS Pro

4574
12
Jump to solution
10-25-2017 01:31 PM
MatthewDriscoll
MVP Alum

Using a C# .Net add-in I need to run a custom python script tool from my toolbox from with-in the map in Pro.   The sample "CallScriptFromNet" will not work because it runs the Python script from outside of the Pro environment.  I have things in the script that uses many layers from the "CURRENT" map so it fails running it the way the sample shows. The script works great when I run it from the toolbox, but I cannot figure out how to run it from the .Net add-in. I am thinking I need to use some sort of combination of getting a Geoprocessing Project Item and Executing it?  

12 Replies
gauthierverlin
New Contributor III

Here is a link to my project if you want and have time to take a look :

Link to my folder

In test1.py, almost everything is in comment because it's meant for test.

The only thing to change ot test the button is the path of the python code in the RunPyScriptButton.cs.

0 Kudos
NobbirAhmed
Esri Regular Contributor

Our system is not letting me download from the link – you can send as zip attachment.

0 Kudos
gauthierverlin
New Contributor III

Here you can find the .zip in attachement.

Thank for helping and taking time for me

Have a great day

0 Kudos