Since I am not sure what operation you are envisioning, I will explain the general methods for integrating Gdscript with VS.
Basically, you will likely use Godot’s signal functionality.
Send a signal from the Visual Script, and perform calculations in the Gdscript that receives the signal.
Assign variables or other elements via a method, then send a signal from the Gdscript and transition based on the signal reception condition.
Such approaches are considered possible.