- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Code that worked perfectly yesterday now no longer functions, I wonder if its related to the update?
I have been keeping a global variable document called settings associated with my plugin, this allows me to keep track of things like the ui and app variables across many documents so that I can create complex commands without cluttering up my main python file.
But this morning it stopped working. Code that works in a regular python enviroment won't function in the plugin anymore.
Here is simplified code below with two documents: setting.py, and HelloPlugin.py. They ar ein the same file location, in the add-ins folder for Fusion 360 and it should, on startup create a message box that says: "Hello addin: stuff". Really simple but not functioning. Can anyone see the bug or let me know why this isn't working any more?
#settings.py
stuff = None
def init():
global stuff
stuff = "stuff"
#HelloPlugin.py
import settings
settings.init()
import adsk.core, adsk.fusion, adsk.cam, traceback
app = None
ui = None
def run(context):
try:
global app
app = adsk.core.Application.get()
global ui
ui = app.userInterface
ui.messageBox('Hello addin: '+settings.stuff)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
def stop(context):
try:
ui.messageBox('Stop addin')
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Solved! Go to Solution.
