How to use gravity_forms _enqueue_scripts() without using it in header.php

We need to use gravity_form_enqueue_scripts() to load styles and scripts when the form is loaded using a shortcode or PHP function call.

But the gravity_form_enqueue_scripts() only works when we put it in header.php, before wp_head(). It’s not working when it’s put in other places for example funtion.php of a theme or in any other PHP file. The issue is that if one edit’s the header.php of a theme it will get overwritten the next time the theme updates.

Is there any better solution than putting it in header.php?

See my answer to you on another post: