diff --git a/idaes/core/base/property_base.py b/idaes/core/base/property_base.py index 128f22beca..d334658f75 100644 --- a/idaes/core/base/property_base.py +++ b/idaes/core/base/property_base.py @@ -781,7 +781,13 @@ def __getattr__(self, attr): attr: an attribute to create and return. Should be a property component. """ - return build_on_demand(self, attr) + try: + # try the Pyomo Block's __getattr__ method first which will return + # decorators for creating components on the block (e.g. Expression, + # Constraint, ...). + return super().__getattr__(attr) + except AttributeError: + return build_on_demand(self, attr) def calculate_scaling_factors(self): super().calculate_scaling_factors() diff --git a/idaes/core/base/reaction_base.py b/idaes/core/base/reaction_base.py index fc21c47775..981089346f 100644 --- a/idaes/core/base/reaction_base.py +++ b/idaes/core/base/reaction_base.py @@ -361,7 +361,13 @@ def __getattr__(self, attr): attr: an attribute to create and return. Should be a property component. """ - return build_on_demand(self, attr) + try: + # try the Pyomo Block's __getattr__ method first which will return + # decorators for creating components on the block (e.g. Expression, + # Constraint, ...). + return super().__getattr__(attr) + except AttributeError: + return build_on_demand(self, attr) def calculate_scaling_factors(self): super().calculate_scaling_factors()