cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Python Script Hot Reload - No Restart Needed

Python Script Hot Reload - No Restart Needed

Adding or changing a custom support script currently requires closing and reopening Plant 3D before the change takes effect.

 

`PLANTREGISTERCUSTOMSCRIPTS` alone does not refresh the running session. Autodesk forum discussions have indicated for years that restarting Plant 3D is the only solution.

 

Please make an option for the register command to refresh the scripts in the current session.

 

This is possible. Plant 3D loads the script library at startup and maintains it in five places:

* Files on disk (`variants.map` and the individual `.xml` files)
* The .NET content adapter's in-memory script list
* The content adapter's folder cache
* The embedded Python script list
* The generated geometry, stored in the drawing as a block

 

The three middle caches are cleared when Plant 3D restarts. The generated block remains in the drawing until it is purged.

 

I wrote a plugin that clears all five. It allows a script to be reloaded and used without closing Plant 3D.

If you would like a free copy to test in your environment, LIKE this post then send me a DM for the link. Note that it is beta and 'proof of concept' only. No support will be provided.

 

The package includes builds for Plant 3D 2021–2024 and 2025–2026. I've only tested it on 2024. It relies on undocumented internals and is not supported by Autodesk, so consider it a workaround rather than a fix.

3 Comments
diego_pena97PFG
Contributor

Hi @jabowabo,

Good to see the hot-reload idea in front of Autodesk, it's the right ask, and I hope it gets the votes it needs.

I published the method on September 19, 2026, as far as I know the only public description of it anywhere, the caches, why a restart is what clears them, and the three-step procedure that refreshes them in a live session:

https://beyond-the-docs.hashnode.dev/registering-a-new-plant-3d-support-script-without-restarting-on...

The article is MIT and free to use, and it asks for one thing: attribution to Beyond The Docs if you republish or build on it. So if any of your write-up came from there, please add a line with the link.

Your plugin is your own work, six versions built and tested is more than I did, I only ever ran this on 2025. I'm asking about the reference, nothing else.

Diego Peña.

jabowabo
Mentor

@diego_pena97PFG 

 

From the ReadMe:

## Credit

The idea for clearing Plant's caches without restarting came from Diego Peña's article on Beyond The Docs, [Registering a New Plant 3D Support Script Without Restarting: One Level Below the Content Cache](https://beyond-the-docs.hashnode.dev/registering-a-new-plant-3d-support-script-without-restarting-on...). That article is what pointed this project at the problem.

This plugin's method for reaching those caches is its own, and it differs from the article's in several places. It also adds a fifth cache the article does not cover: the finished shape already drawn in your file, saved as a block. Without clearing that block, nothing new would appear on screen even after every other cache was cleared.

diego_pena97PFG
Contributor

Appreciated, thanks for adding it. The block is in the article too — Notes and Caveats, last bullet on a modified script. Good luck with the Idea, it deserves the votes.

A modified script reloads in the same session too. The register regenerates its .xml and .pyc, and popping the name out of varmain and sys.modules is what makes the reload take effect: with reload(varmain) alone the old function kept running. What is not a cache at all is the drawing: geometry the script has already placed lives on as a block, so the old shape stays until you PURGE it and place again.

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

Submit Idea