Python Toolbox Initialization ArcPro Version 2.0 Vs ArcPro Version 2.2

709
1
08-16-2018 12:57 PM
JimHowser
New Contributor

To my ArcPy Colleagues,

I have recently upgraded from ArcPro Version 2.0 to ArcPro Version 2.2, but have noticed substantial time differences when initializing custom python toolboxes.  I've reduced the code down to parameters and a blank external script and have started honing in on a few potential culprits including the number of parameters and the number of external scripts loaded.  It appears each parameter adds time to the initialization in ArcPro 2.2, however, has no influence on initialization time in ArcPro 2.0.  This time gets extended further when adding external scripts through this technique:

Import ModuleX

Import importlib

importlib.reload(ModuleX)

I am wondering if anyone else has had this issue and if they can explain why this issue is occurring and how to prevent it.  In addition, this exact same code in ArcMap initializes almost instantaneously with many more parameters and multiple Import calls to custom scripts.  I've attached a generic .pyt code so you can test the custom python toolbox in ArcPro yourself.  (the Import externalScript line is a placeholder for an external script so you can create this file and fill it with code, and you will see there is additional delay when initializing) 

Summarizing -  When running the Python Toolbox on ArcPro Version 2.0, the tool initializes instantly.  I only started noticing the problem when I upgraded to ArcPro 2.2 about a week ago.  So, clearly, it has something to do with the new version of ArcPro.  My solution for now is to downgrade to ArcPro Version 2.0, however, this is not ideal.  

Please let me know if you have any ideas or solutions to get this to work on ArcPro Version 2.2!

Thanks!

0 Kudos
1 Reply
ChrisKrebs1
New Contributor II

I'm also experiencing extremely slow initializing times for my script tools that have several input parameters. In my case (v2.3.1), I have 10 input parameters and my tool takes several minutes to initialize before it even start running the python code.

0 Kudos