Chain multiple panels

I tried to connect 4 panels of 16x32 matrix together and drive them with matrix portal m4

I found this code that I could specify the number of chained panels.

However, it doesn’t specify how could we use the code. Should it be in code.py and thrown in the matrix portal, or it should be saved as another Python file and put into the matrix portal?