I’m not sure, if there is a way to ignore attributes, which seems to be your case. I.e. if you initialize Foo as an nn.Module it would also be scripted as a RecursiveScriptModule, but I guess you don’t want that.