Accessing javascript in multiple files [closed]

You have to create a dependency with

wp_register_script($handle, $src, $dependency, $version, true/false);

See WP codex: wp_register_script
and then make sure that the second file is loaded correctly and right after the initial script.

The third parameter is an array for dependencies/other “handles”.

So..in your case:

<?php
    // Functions.php or somewhere else
    wp_register_script('my_first_script',get_template_directory_uri().'/js/my-first-script.js', array('jQuery'), '1.0', true);
    wp_register_script('my_second_script',get_template_directory_uri().'/js/my-second-script.js', array('jQuery','my-first-script'), '1.0', true);

Where

...,array('jQuery','my-first-script'),...

is the dependency of your script which wordpress will handle for you (placement head/footer).

Last parameter bool true means, that is loaded in the footer.
Also make sure, that your functions in jQuery have correct scoping.

That will register the scripts to wordpress, then enqueue them:

<?php
    ...
    wp_enqueue_script('my_first_script');
    wp_enquque_script('my-second-script');

?>