apply_impulse is a method on Rigidbody2D and RigidBody3D.
If you create a new scene chose one of these for objects you want to apply impulses too or make your script extend from Rigidbody2D/3D
class_name ExampleName extends Rigidbody3D
https://docs.godotengine.org/en/stable/classes/class_rigidbody2d.html
https://docs.godotengine.org/en/stable/classes/class_rigidbody3d.html
Example:

class_name Ball extends RigidBody3D
func throw(direction: Vector3):
apply_central_force(direction * 300) # or in your case impulse
class_name is optional