I observe that I cannot instantiate a child process in Vue.js. Is there any way to execute a python script in Vue.js (2.x) ?
Vue is strictly a client-side framework, except when being used from Nuxt.js. If you’re not using Nuxt, you would need a server of some sort (whether Python or Node or something else), and that could call a python script when needed. If you are using Nuxt, you could call Node’s
child_process.spawn (or exec, or spawnSync or execSync) to run a Python script (see these docs). One last alternative would be transpiling your python to JS or compiling it to WebAssembly, but it sounds like what you want to do is run a server-side script, so that wouldn’t work for you. My recommendation would be to serve your Vue app from a Python server (or some other server that can exec Python).