This question already has an answer here:
I don't understand exactly what the procedure is if a character wielding a two-handed weapon decides to use a potion or similar item that requires a free hand. The fact you need an action to drink the potion is fine, but I don't fully comprehend the part about withdrawing the potion from your backpack while you don't have any free hands, per Can a character grab a potion from a pack and drink it without using their action?
Can the character temporarily hold the weapon with one hand, grab the potion, use the action to consume it, then return to holding the weapon with two hands? The two-handed property only states you need two hands to use the weapon, not to hold it. And freeing one hand and grabbing the potion seems to be part of the "object interaction" aspect of movement.
If the character cannot, what is the proper procedure? Does the character drop the weapon as a free action, grabs the potion as "object interaction", uses it as an action, then later has to spend an action to grab the weapon from the ground?