move function load_script to separate file