"Could not get qualified name for class xyz: __module__ can't be None"

Hello!
I am currently trying to convert the FFB6D pose estimation model to TorchScript.
Since it has a lot of conditional flows, I have to jit.script it. However, I am totally new to Scripting and there aren’t a lot of tutorials out there…

I instantiated the model with the best checkpoint and supplied a batch size of 1 to my model with the data generator that is also used for training the network.

model.to('cpu')
for (batch_idx, batch) in enumerate(train_loader):
    scripted_module = torch.jit.script(model, batch)
print(scripted_module.graph)

Now whenever I try to run it it throws following error:

File “/home/miriam/anaconda3/envs/ffb6d/lib/python3.6/site-packages/torch/jit/_script.py”, line 1362, in _get_overloads
qual_name = _qualified_name(obj)
File “/home/miriam/anaconda3/envs/ffb6d/lib/python3.6/site-packages/torch/_jit_internal.py”, line 1015, in _qualified_name
raise RuntimeError(f"Could not get qualified name for class ‘{name}’: "
RuntimeError: Could not get qualified name for class ‘conv2d’: module can’t be None.

It’s a really big network, so i much rather send a link to the github page with the network file:
FFB6D.py Model

This is the file with the conv2d implementation where the error occurs:
Pytorch_Utils.py Conv2D