Here is the sample that I have been testing.
Script1A is embedded in the toolbox but not password protected
SCRIPT1A
# import ArcGis Geoprocessing module
import arcpy
import os
relPath = os.path.dirname(__file__)
arcpy.AddMessage(relPath)
toolPath = relPath + r"\TestModulesEmbed.tbx"
arcpy.AddMessage(toolPath)
arcpy.AddMessage(". . . Starting Script1A")
# The tool is identified by the toolname and the toolbox alias
# Import the custom toolbox
arcpy.ImportToolbox(toolPath)
# Run the tool
arcpy.Script1B_TestModules
arcpy.TestModules.Script1B
Script1B is embedded (imported) into the toolbox and also password protected
SCRIPT1B
# import ArcGis Geoprocessing module
import arcpy
import os
arcpy.AddMessage(". . . Script1B has been called")
def printmessage():
arcpy.AddMessage(". . . Starting Script1B")
This is the result when running the code:
Executing: Script1A
Start Time: Sat Aug 06 09:52:10 2016
Running script Script1A...
C:\Data\NewContract\MyWork
C:\Data\NewContract\MyWork\TestModulesEmbed.tbx
. . . Starting Script1A
Completed script Script1A...
Succeeded at Sat Aug 06 09:52:10 2016 (Elapsed Time: 0.08 seconds)
Ideas of how to make this work will be appreciated. I would like to protect the portion of the
script that accesses Oracle.
Thanks,
Dan