Hi @ShaunWalbridge,
I've found the problem here, but I'm at a loss as to how to fix it. I may have to create a Tech Support ticket because I would describe it as a bug.
Summary:
- I have two, separate Python toolboxes with similar file paths and file names on my PC.
- One is a development toolbox while the other is for staging/production.
- When I load/run the dev PYT, it is referencing the files (.py, .pagx, .lyrx, etc.) in the prod PYT's folder.
This behavior is rather inconsistent. I'm not sure if it's a Python issue or something wrong with ArcGIS Pro folder connection configuration or I'm totally doing something wrong.
Sometimes after a restart, the problem goes away but not always.
The folder structures are something like this:
dev_folder
- DevPythonToolbox.pyt
- subfolder
-- __init__.py
-- module.py
-- other supporting files
prod_folder
- ProdPythonToolbox.pyt
- subfolder
-- __init__.py
-- module.py
-- other supporting files
The relevant code is like this:
# Top of DevPythonToolbox.pyt
import arcpy
from subfolder import module
from importlib import reload # for dev only
reload(module) # for dev only
...
class Tool(object):
def __init__(self):
...
def execute(self, parameters, messages):
"""The source code of the tool."""
from subfolder import module # for dev only
from importlib import reload # for dev only
reload(module) # for dev only
if __name__ == "__main__":
module.main(parameters)
return
Is there a place where these file paths are cached or indexed? I have already tried deleting Local Caches and Index folders in C:\Users\user\AppData\Local\ESRI.
Thanks,
Ryan