Okay! I won't tell you that. Just put ALL YOUR CODE ALL IN ONE FILE and then paste it into a tiny box in ArcGIS Pro! What could go wrong? Ha ha ha ha. Who cares about version control? ANYWAY
I am working on this problem right now too. I've been fiddling with the differences between Python toolboxes and Script tools the last couple days.
Something that might help you (since I have no real answer for you yet) is to print out the entire environment from inside a tool so you can look at what environment settings you have. This should include BOTH the system environment and the arcpy environment.
Then you can decide if you want to try to force it to use an environment setting in your Python to make it find your modules.
import os
import sys
import arcpy
# HA HA HA YES THIS IS WHAT I DO RIGHT NOW BUT I HATE IT AND WANT TO FIX IT
sys.path.append("K:/ORMAP_CONVERSION/ORMAP_PRO")
from taxmap import BuildTaxMap
def show_environment():
arcpy.AddMessage(f"Current directory: \"{os.getcwd()}\"")
arcpy.AddMessage("os environment --------------")
for i in sorted(os.environ):
arcpy.AddMessage(f"{i}, {os.environ[i]}")
arcpy.AddMessage("arcpy environment --------------")
for i in sorted(arcpy.env):
arcpy.AddMessage(f"{i}, {arcpy.env[i]}")
return
# Then call that function, in a PYT you can call it from "execute"
# or from a script tool, from the "main" section
if __name__ == "__main__":
# This code executes every time you run the tool
# from the toolbox, not just from the debugger.
show_environment()
I will try to post something more definitive later but now I have to go fix a printing problem in a web app. Grr.