Define Multi
as a VimScript function and call python inside it:
python3 <<EOF
import vim
class Multiply:
@staticmethod
def myfunc(n):
print("Answer is:", n * n)
EOF
" Single global instance
python3 m = Multiply()
function! Multi(i)
" int() is required as vim.eval() returns a string even for int arg
python3 m.myfunc(int(vim.eval('a:i')))
endfunction
Test: :call Multi(4)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…