Can I share a GPU between a LXC and a VM in Proxmox?

I am running Proxmox 8.2.5 and I have it set up where my GPUs are shared amongst multiple LXCs.

What I want to do now though, is that when a GPU isn’t actively being used by a LXC, I want to be able to share one of my two GPUs with a VM, and then when the VM is done with it, quote “give it back” for the LXC to use.

Is there a way to do that?

I have tried using a hookscript that someone else wrote in Perl, but with the LXC running (and therefore; the GPU is already “passed through” to it), the hookscript has a hard time trying to “(re-)claim” the GPU for the VM.

And the hookscript also troubles unbinding the GPU from said VM when the VM is shut down from inside said VM.

Any help/advice/suggestion is greatly appreciated.

(And yes, I have already posted this question, in the Proxmox forums.)