Despite some thoughts here, you *can* localize a pattern variable without switching to `SetDelayed`: ClearAll[f, x]; x = 1; Module[ {y = 0}, f[x_] = x^(1 + 1) + y ]; ??f (*f[x$_]=x$^2*)