XBlocks: Get path of json file stored in public with runtime.local_resource_url()

When you call

url_to_model = self.runtime.local_resource_url(self, “public/model.json”)

the full (absolute) URL of that file (as needed for the browser) should be stored in url_to_model, so you have to pass that entire URL to your JavaScript code. Something like this (combine with my answer to your other question):

In python student_view:

    data = {
        "url_to_model": self.runtime.local_resource_url(self, “public/model.json”),
    }
    fragment.initialize_js('MyBlock', data)
    return fragment

In JavaScript:

function MyBlock(runtime, element, data) {
    console.log(`Load from the URL ${data.url_to_model}`);
}