Errors should display error line (No solved) & Error in Classes with opencv (Solved)

I import opencv like ‘import cv2 as cv’ but it should work, so i do not know where the error is in my code.

Seems error comes from lines I show, seems OPENCV does NOT WORK in CLASS

If I want to use opencv in a class or functrion I need to import it inside method or function

I found the solution: global cv, np before imports
How to make global imports from a function?