Instead of `xmodule.location`, switch to using the xblock equivalent: `xblock.scope_ids.usage_id`