An intriguing variation on this theme emerges when the defence wants to immunise someone.
In Australia and other Commonwealth places (subject to local specific variations) the fundamental idea is that the decision to prosecute is ultimately one for the prosecution, and it is a violation of the separation of powers for courts to become involved in granting immunities no matter how convenient that might be.
So let us suppose that Imogen Innocent is charged with murder. Her position is that she did not do it. She claims that it was Dave Dastard who did it. The prosecution snort in derision at her claim.
To make good her claim, she wants to call Dave Dastard to the stand in the defence case. (Let us overlook minor forensic embuggerances like the problems that might emerge with the form of questions that can asked in evidence in chief).
The Crown aren’t going to immunise Dave - to them this is a red herring. There is no prosecutiorial interest being advanced by this, not even the general obligation to be fair. The Crown will not immunise a person who they do not think did it.
So all Imogen can do is call Dave, who will then claim privilege. This is unsatisfactory from her perspective. While the mere fact of claiming privilege is suspicious, there is no guarantee that the jury will consider that that fact alone raises a reasonable doubt. Indeed it is quite unlikely to. The jury will want to hear evidence.
So what is Imogen to do?
In the state of Western Australia, parliament was persuaded to pass legislation that allowed a judge to grant immunity in these circumstances to Dave. Doesn’t presently matter whether it is transactional or U/DU immunity.
The problem was that until Dave actually gave evidence, the judge was in no position to determine the validity of the claim. And Dave is not going to give an account of himself until he has immunity. So judges, in the interests of the accused, were granting immunity on essentially the basis that Imogen said it was Dave.
This led to a huge problem.
Let us suppose now it is not Imogen and Dave, but Fat Tony and Johnny Tightlips.
Fat Tony has whacked a stoolie. He wants to create reasonable doubt. He calls Johnny Tightlips to confess. Johnny knows all about the killing because Fat Tony has told him all about it. Johnny can safely, and falsely, claim responsibility. This might very well create a reasonable doubt. Fat Tony goes free. Johnny is at risk for perjury, but that risk is very low. The evidence to prove he perjured himself is the same evidence that failed to convict Fat Tony.
As soon as this scam emerged, WA rapidly changed is laws back again.
So how is this problem (of the defence needing to immunise potential witnesses) solved in the US?