I have been struggling with this for a while now and am stuck I am writing an extension for ExpressionEngine 2 (not a module) and need to add a script tag to the header of the page.
I have tried:
but im guessing this only works when its a module, i have also tried (which i am pretty sure should work):
but i get the following error:
Call to a member function plugin() on a non-object in expressionengine/libraries/Cp.php on line 766
I have also tried using the hook
cp_js_end which loads the file but its loaded after everything else thus it does not work as intended.
After playign around with this it looks as if you can only use
$this->EE->cp->load_package_js('file'); for modules and not extensions.
I will close this issue