Add_resource works from inside a function. Resources can be loaded this way, only problem is that they won't add new scripts or replace old scripts.