Curious why this is not allowed any longer: SyntaxWarning: import * only allowed at module level
Here is my script using import *.
def getRunnngXL():
try:
import System
import os
import clr
user = os.environ["USERPROFILE"]
#C:\Users\ebunn\SEE RhinoScript
path = user + "/SEE RhinoScript/XL_Utils/bin/Release/net48/Utils.dll"
print (path)
clr.AddReferenceToFileAndPath(path)
from Utils import *
excel = Marshal2.GetActiveObject("Excel.Application")
print(excel,"Excel")
return excel
except:
print("Excel not Running")
Problem is if I locate the line “from Utils import *” outside of the function is doesn’t work. It relies on the other commands before it within the function. Looking for a work around.
The code comes from here: https://discourse.mcneel.com/t/connecting-to-excel-code-doesnt-work-in-rhino-8/198192
Maybe I should be posting this problem there? It’s really a problem with the new ScriptEditor. The script works fine when run from the old IronPython editor.
Thanks for the help!
Eric