Inconsistency with how other scripted functions and forward handle member values

Hi I’m trying to understand why I’m allowed to use a member value like this in forward but not in a custom scripted function.

import torch
import torch.nn as nn

class TestClass(nn.Module):
    def __init__(self, y): 
        self.y = y 
        super().__init__()

    def forward(self, x): 
        if self.y > 0:
            return torch.zeros([1,1])
        else:
            return torch.ones([1,1])

#    @torch.jit.script
    def test(self, x): 
        if self.y > 0:
            return torch.zeros([1,1])
        else:
            return torch.ones([1,1])

tester = TestClass(1)

torch.jit.script(tester)```