I'd like to run some Python code directly when Fusion launches. In the scripting guide I found you can save a .scriptlib file with some custom Lua code to run at Fusion launch. This gets triggered nicely.
For example I can put in:
- Code: Select all
print "a"
And the console will have the "a" printed directly after launch, but trying to Execute Python code raises errors. For example:
- Code: Select all
Execute("!Py: print 'a'")
This will actually execute the code (and seemingly run fine) but Fusion will spam me two huge error popups that state: "1: attempt to call global 'Execute' (a nil value)"
Though, magically this works without errors:
- Code: Select all
while composition == nil do
-- wait around until fusion is running
-- this is to avoid error pop-up: attempt to call global 'Execute' (a nil value)"
end
Execute("!Py: print 'a'")
But that doesn't look like the way it should be done and it looks a bit hacky.
In my case I'm looking for the easiest way to run Python code at Fusion launch - is this it?