I have problem defining arcpy.env.workspace in a separate module when publishing the script as a Geoprocessing Service on arcgis server.
For instance:
my main tool script:
from myModule import myTool
workspace = "Database Connections\\GEOP011@demma18.sde"
tableName = "DEMMA18.MyTable"
myTool.execute(workspace, tableName)
myModule.myTool:
import arcpy
def execute(workspace, tableName)
arcpy.env.workspace = workspace
doSomething(tableName)
def doSomething(tableName)
with arcpy.da.SearchCursor(tableName, ["OBJECTID"]) as cursor:
for row in cursor:
print(row)
When published to the server, this script will return error : cannot open DEMMA18.MyTable
However, if I put the same code in a single .py file it runs on the server without error. Any Idea what is going wrong?