Adding javascript with dependency.

Hi, my goal is to add JavaScript to a page. I've managed to do this using the functions.php (in a child theme, of course:slight_smile:, and registering my function to the wp_head() action hook. I see the Javascript function in the page, after doing all this. However -

Here's where I need help, I want the function that I'm adding to be included *only* when the home.php template file (for single group) is loaded, which is in my themes/child-theme/groups/single folder. Basically, this is the page that shows up when I click on the link for a specific group from a list of groups. So I want the JavaScript function to be included (and hence invokable) only when the user clicks on a specific page, namely the single group (when the user selects a group from the list of groups).

Do I just add a conditional in the functions.php for the function to do this, but this is where I also need help, if this is how I should proceed, is what conditional do I need to use - I tried is_home(), but then there is a home page for other sections of the theme, and I want it (the JavaScript) function to be included/invokable only when the single group page is loaded.

Please advise.