Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Restart Fusion's Python Environment

4 REPLIES 4
Reply
Message 1 of 5
scruffmeister
601 Views, 4 Replies

Restart Fusion's Python Environment

Hi,

 

During development of a reasonably complex script using multiple Python files, I am finding that when I make changes to method and object signatures I have to restart Fusion for it to pickup the changes. My project source is organised into folders under the script directory. Simple code changes within existing methods are picked up as you would expect.

 

I assume this behaviour is the consequence of some caching in the Python environment which is run by Fusion, whose lifetime spans script executions. Is there a way to force a restart/reload of Fusion's Python environment so that refactoring changes can be picked up without having to restart the entire Fusion application?

 

Thank you.

4 REPLIES 4
Message 2 of 5
0xHexdec
in reply to: scruffmeister

Sems strange to me, as I havn't had this problem before. How to you restart your script? Do you use the debugger connected to Fusion to restart it, as this should make sure the project is up-to-date.

Do you load modules dynamically?

Dumb question, but if you use vscode, did you make sure to save the changes before running the script?

Message 3 of 5
borrinboing
in reply to: scruffmeister

Hey, scruffmeister

I was having the exact same problem. It was a lot of frustration trying to fix a bug in my module before I realised my changes weren't being instantiated when re-running my original script... No idea why Fusion operates like this...

 

It's not elegant, but the work around I'm using is to have:

import importlib
import myModule
importlib.reload(myModule)

importlib allows you to forcibly reload modules and this will have to do while developing myModule.

Hope that helps.

 

I'm an OSX user, are you? It might be a unique Mac feature issue?

Message 4 of 5
JPKM20402
in reply to: borrinboing

I was having the same issue and it has been very frustrating.  The simple defined solution also worked for me within OSX.

Message 5 of 5
riik_b
in reply to: borrinboing

hey,

 

i had the same problems and i reloaded adsk.core and adsk.fusion after which it ran as it should, this was on windows. So thanks for the tip

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report