How to Inject a JS library and run some code after a delay on a webpage

How do I inject a jquery library after a delay like 10 seconds and then run some code based on jQuery?

You can create an Insert Scripts rule with Language as “JavaScript” and Code Source type as “CODE”. You may then enter the JS snippet to setTimeout for
__ secs (the delay), inject jQuery by adding a script tag, and on load, add the jquery command.

e.g for 10 second delay, here is a sample code:/

setTimeout(function () {
    const script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = 'https://code.jquery.com/jquery-3.6.1.min.js';
    script.onload = function() {
        console.log('Loaded jQuery version: ' + $().jquery);
    };
    document.documentElement.appendChild(script);
}, [10 * 1000]); // 10sec sleep