diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29b..d86bd917 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: minor + changes: + fixed: + - Reforms always apply before parameter utilities. diff --git a/policyengine_core/simulations/simulation.py b/policyengine_core/simulations/simulation.py index e8ff868d..1b359c34 100644 --- a/policyengine_core/simulations/simulation.py +++ b/policyengine_core/simulations/simulation.py @@ -66,6 +66,7 @@ def __init__( dataset: Union[str, Type[Dataset]] = None, reform: Reform = None, ): + reform_applied_after = False if tax_benefit_system is None: if ( self.default_tax_benefit_system_instance is not None @@ -73,14 +74,21 @@ def __init__( ): tax_benefit_system = self.default_tax_benefit_system_instance else: - tax_benefit_system = self.default_tax_benefit_system( - reform=reform - ) + # If reform is taken as an arg, pass it + try: + tax_benefit_system = self.default_tax_benefit_system( + reform=reform + ) + except: + tax_benefit_system = self.default_tax_benefit_system() + reform_applied_after = True self.tax_benefit_system = tax_benefit_system self.reform = reform self.tax_benefit_system = tax_benefit_system + if reform_applied_after and reform is not None: + self.apply_reform(reform) self.branch_name = "default" if dataset is None: