content.js
function foo(){
console.log('bar');
}
foo();
Manifest
"content_scripts": [{"matches": ["<all_urls>"],"js": ["content.js"]}]
Everything works fine and the function executes when the page is loaded but is it possible to call this function through the console by myself?
As Ivàn already pointed out, you need to change the context of execution from the Developers Tools' console. In the top left corner there is a dropdown menu, from there you can change the context. I attached a screenshot to help you find it.