import torch.nn as nn
import torch.jit as jit

class TestModule(jit.ScriptModule):
  def __init__(self):
    super().__init__()
    self.linear = nn.Linear(16, 16)


m = TestModule()
print(m.linear.in_features)

The code above throws AttributeError
>>> m.linear.in_features
Traceback (most recent call last):
  File "/home/qbx2/anaconda3/lib/python3.7/site-packages/torch/jit/__init__.py", line 1197, in __getattr__
    return ScriptModule.__getattr__(self, attr)
  File "/home/qbx2/anaconda3/lib/python3.7/site-packages/torch/jit/__init__.py", line 1102, in __getattr__
    return Module.__getattr__(self, attr)
  File "/home/qbx2/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 535, in __getattr__
    type(self).__name__, name))
AttributeError: 'WeakScriptModuleProxy' object has no attribute 'in_features'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/qbx2/anaconda3/lib/python3.7/site-packages/torch/jit/__init__.py", line 1200, in __getattr__
    return getattr(self.__dict__["_original"](), attr)
AttributeError: 'NoneType' object has no attribute 'in_features'

Looking at the code (https://github.com/pytorch/pytorch/blob/master/torch/jit/ 4init.py#L1226), I think WeakScriptModuleProxy should have copied in_features and other fields to self here.
I’m just posting this issue here to check if any workaround for this already exists.
Thank you.