Script, RuntimeError: Module X has no attribute Y:

Code is not needed to explain it, but basically, X class is (nn.Module) with other custom (nn.Module)s as its attributes.
The attribute Y is also defined & running outside of script normally.
However in the code I’m getting this exact error…

The problematic scenario is shortly as below;

Module’s init()
self.attn_cond_layer = AttentionConditioningLayer(
input_dim=2, attention_n_filters=32,
attention_kernel_sizes=[5, 3],

Module’s forward()
attn_cond_vector = self.attn_cond_layer(attn_cat).permute(2, 0, 1)

—> error occurs right here… (Module ‘AR_Step’ has no attribute ‘attn_cond_layer’) What could be the problem?

for extra information, the definition of Y attribute is below;

class AttentionConditioningLayer(nn.Module):
“”“Adapted from the LocationLayer in
https://github.com/NVIDIA/tacotron2/blob/master/model.py
1D Conv model over a concatenation of the previous attention and the
accumulated attention values “””
def init(self, input_dim=2, attention_n_filters=32,
attention_kernel_sizes=[5, 3], attention_dim=640):

Could you post a minimal, executable code snippet to reproduce the issue, please?