When you reference a script with type="module", it gets loaded as an ES6 module, rather than in global scope. If you want stockClicked() to be available globally, just remove type="module" from the script tag.
If you really need to use type="module", then you have a couple of options:
Create a new inline module script tag that imports from script.js and assigns the stockClicked() function to the global scope explicitly, by saying window.stockClicked = stockClicked.
Add the click listener programmatically instead of in HTML. In other words, after the p tag, add an inline script that gets the element by id and adds a click listener. Something like this:
import {stockClicked} from './script.js';
document.getElementById("stock").addEventListener("click", stockClicked);
In both cases, you need to export the stockClicked() function from script.js. Also, it's recommended to name module files with .mjs instead of .js.
""at your src.document.getElementById('stock').addEventListener('click', stockClicked)