ScriptJob applying a bevel problem

I have a function that removes a bevel node from an object and reapplies it with the same settings to all of the mesh’s hard edges. The node isn’t disconnected/reconnected, it’s completely deleted and a new one with the same attribute values is created. I use this to update bevels when changes are made to the base mesh’s topology. It works great for what I need.

I set up a scriptjob to call the same function periodically, but it gives me an error that the object’s edges do not exist.

newBevel = cmds.polyBevel3(hardEdges, ws=True, ch=True)[0]
ValueError: No object matches name: ['|cube_brush1.e[0]', '|cube_brush1.e[1]', '|cube_brush1.e[2]'.....

The object is in the scene, the path is correct, and the function works as expected when not called from a scriptjob. I assume I’m missing something about the way scriptjobs work and what data they can access/modify and hoping someone can fill me in.

Solved it:

I was using a threading.Timer to trigger the refresh action after 1 second, and canceling/restarting the timer if it was triggered again within one second. The reasoning being that if a few modifications happened in quick succession it wouldn’t refresh until a second had passed after the last operation.

Turns out if I call the function directly instead of letting a timer do it, it works fine, so I guess the bug was something to do with the function being called on a different thread maybe?