How to create Traceable and Differentiable CUSTOM C++ OPERATORS with CUSTOM C++ CLASSES as argument in Python?

I learnt CUSTOM C++ OPERATORS and CUSTOM C++ CLASSES [ Extending TorchScript with Custom C++ Classes — PyTorch Tutorials 1.13.1+cu117 documentation].
I can create autograd::Function using custom OPs and custom classes and use it in C++.

But what if I want to reuse that written autograd::Function in Python.

  1. Are there any methods to do so?
  2. Or I must implement Python-version autograd.Function with the custom ops? Would it be Traceable and Differentiable?

I saw one blog Lernapparat - Machine Learning using TraceableFunction. But it is rather old and I don’t know if it can support custom class. Are there any new recommended methods?