I have written some really long functions in javascript already, and now I want to utilise and can't write them again in python, but the data I'm receiving is from python code. So I'm translating the javascript code into python using js2py.translate_file. The data is in a matrix format, so after translating the js file, while I make a call to a function how do I pass the matrix from py file and how do I receive it in the js function?
I know it will be easy to just write the function in py file instead, but I had already written it in js and now I'm desperate to use it from js file, Please help me get this...
This is the code in the py file.
import js2py
js2py.translate_file("j_script.js", "my4.py")
from my4 import *
my4.get_data(mat)
This is the function in the js file that will receive the data.
function get_data(grid_wise){
for(var bi=0; bi<9; bi++){
for(var ni=0; ni<9; ni++){
new_new_matrix[bi][ni]=grid_wise[bi][ni];
}
}
for(var bi=0; bi<9; bi++){
for(var ni=0; ni<9; ni++){
reassign(bi, ni);
}
}
console.log(mat_row_wise);
}