Can I call a global asynchronously refresh?

Dear community,

How can I refresh asynchronously the dependency graph and UI using Python or Mu?

The issue: My code changes the node-connections order, which affects the global timeline (e.g., when shorter media changes to longer). As a result, rv.commands.frame() returns the frame before my reordering at the time I call it.

I’m hoping to find a command that either wait for RV to finish processing whatever it’s doing OR to force an asynchronously refresh.

I tried rv.commands.redraw() and rv.commands.reload(), but sadly they don’t work and the rv.commands.frame() still return the “un-refreshed/old” value.

Any ideas on how to achieve this?

Thank you!

While it is a bit of a hack, when I run into oddities like this, I’ve found its often useful to do a null timer. This effectively allows all the items on the current event queue to flush.

Ultimately, RV is tied into the Qt events, so without giving up GIL and execution flow from Python, you aren’t allowing the application to go and do what you expect when it is expecting things to happen asynchronously, or even serially.

QTimer.singleShot(...) ( QTimer Class | Qt Core 6.5.2 ) should provide you an ability to set a 0ms timer and call a function that can run after it is run, it gets put on the bottom of the event queue and run after what you are likely waiting on.