What is the exact URL for scripts call?

I’m using this to load script from my scripts folder

 pc.app.assets.loadFromUrl('/scripts/raycast.js', 'script', function (err, asset) {
            e.addComponent('script');
            e.script.create('raycast');
        });

But it returns

Loading failed for the <script> with source “https://launch.playcanvas.com/api/scripts/pulse.js".

My asset hierarchy here:
image

Can anyone help me? Thanks a lot.

The scene hierarchy doesn’t match the actual file hierarchy. What’s the reason for loading the scripts like this and not preloading them?

The reason is I’m trying to re-create an entity with all of the old entity’s script at run time after using destroy() on it. So what is the actual file hierarchy? Can you tell me? Thanks a lot.

Wouldn’t it be easier to just clone the entity from a disabled ‘template’ entity?