I created 'class V' in file 'V.py' with some functions, which I want to keep using in other projects, but when I call any of these functions I get an error that the name is not defined. I tried all solutions that I could find and nothing fixes it. Hope somebody knows what am I doing wrong..
class V(object):
    def magnitude(self):
        a=0
        for i in range(len(self)):
            for j in range(len(self[i])):
                a= a + self[i][j] **2
        return sqrt(a)
Calling a function:
from V import V
A = np.array([[1,2,3],[4,0,6],[7,8,9]])
print magnitude(A)
Error:
NameError: name 'magnitude' is not defined
 
     
    