1

I have this python script that I execute inside the ArcMap Python Window and it does an array of spatial analysis processes to get me to my desired final mxd content. I then have another script that overrides my existing feature classes on my AGOL account with the current layers in the open mxd. : Click Here (it is necessary that this script is ran outside of ArcMap via the Python shell. )

The only issue is that after I run my first script in ArcMap I then have to open my python shell outside of ArcMap in order to run the second script. I am trying to find a way to execute the 2nd script from the first script without manually leaving arcmap to open my python shell and load the script. But keep in mind my first script is being run from the ArcMap Python Window. SO I cannot figure out a way to escape that... hope this question makes sense and is this even possible. I am basically trying to eliminate all user-interaction to completely automate this task once I load the first script into ArcMap.

Please feel free to ask if this does not make sense.

closed as unclear what you're asking by Andre Silva, Jochen Schwarze, LaughU, whyzar, xunilk Feb 14 at 19:59

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • In the first script, add code to import and execute the second script. – Tom Jan 4 '17 at 16:33
  • I tried import OS and then tried to execute the 2nd script but it doesn't work. It needs to be ran via shell (from what the ESRI guy told me) so I need to activate python shell from arcmap if that makes sense. – NULL.Dude Jan 4 '17 at 16:34
  • What is the difference between the two scripts? Why can you run one but not the other? – Tom Jan 4 '17 at 16:35
  • 1
    first script is just spatial.analysis processes such as clips, selects, geocoding, etc. the 2nd script connects to my AGOL account and overwrites an existing service with the new output from my first script. The 2nd script is linked in OP. but ESRI support says it must be ran from python shell and not ArcMap Python Window.. which is where I am stuck trying to execute. – NULL.Dude Jan 4 '17 at 16:41
  • 2
    Your .ini is probably referenced by a relative path in your script. Use absolute paths or Try changing your working directory in ArcMap before executing the gp script stackoverflow.com/questions/1810743/… – Ben S Nadler Jan 4 '17 at 17:16