As mentioned in another thread, I am trying to use a working directory to load scripts, models and configuration files. I want my scripts to have a reference to the working directory. However, if I call
os.path.abspath(file), it returns the directory of the initialization point of the program when it was first opened, rather than a path to the file that is actually open.
So, I tried to use getApplication().LayourUri to be a little more reliable, but it seems that this property is null until after the entire file loads. Even if I do something like
def OnFinalize(): print getApplication().LayourUri
it’s still null.
while getApplication().LayourUri == "": pass
prevents loading of the file.
Is there a way to execute code after this variable is set? Why isn’t it set sooner? Both this and my issue with openpyxl seem to ultimately be caused by the interpreter not being reset when the environment is cleared.