Python Api with wallet integration

Hi,we are building a web app with ReactJS as frontend and using Flask for building python apis.
We have integrated My algo wallet in front end.
The issue is retrieving the private key from wallet that would be used for signing the transaction.
So we came up with a solution to send the transaction object in encoded format to the frontend and sign and submit the transaction from the frontend.
But we are unsure that is it the right approach or is there some better solution to it.

Why do you want to send the transaction object from backend to frontend?
You can prepare the same transaction using JS SDK.

So does that mean for every application that we are building we should prefers it with JS rather that any other SDK (Java,python etc)

Well, It depends on the application that you are trying to build.
If your application needs signing from the end-users then you need to use JS SDK.