1

I'm writing a python script tool for ArcGIS Pro that uses a custom GUI created with pyqt. I would like the tool to be able to add and remove layers from the main map in the ArcGIS Pro project it is run from. This works fine normally, but I'm also trying to run the tool in a separate thread so that I can continue using other geoprocessing tools (see here). I can still add layers to the project and save the changes using my GUI, but since I am referencing the project by its full path (rather than arcpy.mp.ArcGISProject("CURRENT")), the new layers won't show up unless I close the project and open it again.

Is there anyway to 'reload' an aprx project that has been modified by another process without closing it first?

4
  • If this was arcmap I would have used automation to drive manipulating of another document, not sure pro supports this? – Hornbydd Nov 4 '20 at 19:41
  • This wont be what you want to hear: But your entire workflow sounds like its better suited to making use of the supported SDK environment to extend Pro, which would probably mean C#. As Pro is threaded and you're essentially extending it by an unsupported way, I could just imagine a bunch of possible issues getting the 2 pieces to successfully and reliably talk to each other. – KHibma Nov 4 '20 at 20:18
  • @KHibma you got it, I'm trying to stay away from the SDK, but maybe I'm on a goose chase. To be clear, are you advising against developing python GUIs in general? Or simply against using the threading module to run the GUI in a separate thread as I mentioned? – Nick Nov 4 '20 at 20:43
  • @Nick I cant comment on the GUI in a separate thread (simply no experience). I will say the GP/Pro team had very specific reasons for not implementing the Python Add-in experience with Pro. (This isn't exactly the same as what you're doing, but close) I dont recall the reasons, but I feel like "python-gui" + Pro wasn't going to work well. But again, I don't recall the why behind the decisions from years ago. – KHibma Nov 4 '20 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.