This is my command that doesn’t work, the method exists in that same python file.
def RunCommand( is_interactive ):
method_to_run()
# you can optionally return a value from this function
# to signify command result. Return values that make
# sense are
# 0 == success
# 1 == cancel
# If this function does not return a value, success is assumed
return 0
When I run if from the editor like so, works:
if __name__=="__main__":
ts = time.time()
rs.EnableRedraw(False)
method_to_run()
print "Elapsed time is {:.2f}".format(time.time()-ts)
Update:
Something I noticed:
When I click to Reset Python Engine afterwards I get this:
I get this all the time and learned to live with it.
The issue seems to be that the scriptcontex is not (properly) loaded or at least scriptcontext.doc is None
As you can see from the traceback, as it has no attribute ModelAbsoluteTolerance
The reason I never tried to find a solution is that I run into this while having multiple instances open and running scripts here and there.
If in your case you are running under ‘normal’ conditions it should not be happening.
I suppose @stevebaer might be able to give some insight why the scriptcontex.doc can end up being None.