This is by design. UI files are separate from Python code. Why don't you start by reading the documentation for UI?