Add a js file and be sure it is executed as last js file? I need to add a js file and make it to be executed as last js file (after all js that belong to modules)

I create a module for this. But I can't manage the order of modules execution. Don't I?
¿should I add this file in my theme or through a function instead?
Using drupal_add_js you can control the order of your JS files by assigning weight through $options array.


  weight: A number defining the order in which the JavaScript is added
  to the page relative to other JavaScript with the same 'scope',
  'group', and 'every_page' value. 
  
  The exact ordering of JavaScript is
  as follows: 
  
  
  First by scope, with 'header' first, 'footer' last, and
  any other scopes provided by a custom theme coming in between, as
  determined by the theme. 
  Then by group. 
  Then by the 'every_page' flag,
  with TRUE coming before FALSE. 
  Then by weight. 
  Then by the order in
  which the JavaScript was added. For example, all else being the same,
  JavaScript added by a call to drupal_add_js() that happened later in
  the page request gets added to the page after one for which
  drupal_add_js() happened earlier in the page request.
  


Code example:

drupal_add_js($file_path, array(
  'weight' =&gt; 10000, // Something higher than the weight of existing items
  'scope' =&gt; 'footer', // Make sure the script tag is rendered in the footer of the page, not the header
  'group' =&gt; JS_THEME, // JS_THEME has the highest group weight and will be rendered last
));