AnsweredAssumed Answered

Import custom arcpy modules in Pro 1.4 (from Python addin structure)

Question asked by rastrauch Champion on Apr 18, 2017
Latest reply on May 10, 2017 by rastrauch

I'm trying to test some of my custom tools, written for a ArcCatalog python addin.   This is my first attempt to use Pro, without the convenience and the power we have with ArcCatalog (but hoping the idea: Add Stand Alone Data Catalog Like ArcCatalog to ArcGIS Pro  will still happen so that this isn't as critical a test ....please vote up the idea! ).


I have several  type scripts to separate/organize my common functions. These are located in my Scripts folder in my addin file structure and I import into my tools/scripts using

from blahUtils import *

from moreBlahUtils import *

# etc...

rather than in a library in the python folder....that is, keep the addin all together.


This structure works well in ArcCatalog running is as an built/installed addin or from the Toolbox/Tool used to create the addin.


Putting aside the differences between Python 2.x and 3.x for the time being, how would I import the utility python scripts within my main tool script?  I have read thru

Importing ArcPy—ArcPy Get Started | ArcGIS Desktop    and

Python migration from 10.x to ArcGIS Pro—ArcPy Get Started | ArcGIS Desktop   (no, I have not run the 2to3 tool yet)

but those seem to refer to fairly standard modules.  I would like to keep my scripts in the folder structure for my toolbox (i.e. the addin structure) if possible.


The error I am getting

Traceback (most recent call last):
  File "\\<server>\c$\Users\<user>\_MyPyAddins\dwcUpdateMasterFGDB\Install\scripts\", line 47, in <module>
    from ADFGUtils import *
  File "\\<server>\c$\Users\<user>\_MyPyAddins\dwcUpdateMasterFGDB\Install\scripts\", line 134
    self.__dict__ = self"""
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 188-189: truncated \UXXXXXXXX escape
Failed to execute (01-CopyDWCMasterSDEtoFGDB).

Is basically telling me it can not find the first custom script from ADFGutils import * I am trying to import. 


Any suggestions on where I need to put these and how I would refer to them?  Again, I prefer to keep in the same folder with/near my toolbox.



tagging Python Python AddIns