Trying to call a create-tag modal from a different Component.
The component I am working in is called pets and is located in: app/main/ClientPatientManagement/Pets
Trying to access the show() method in: app/main/tags/tags/create-or-edit-tag-modal.component'
Here is the code in my Pets.Component:
    import { CreateOrEditTagModalComponent } from '@app/main/tags/tags/create-or-edit-tag-modal.component';
@Component({
    templateUrl: './pets.component.html',
    encapsulation: ViewEncapsulation.None,
    animations: [appModuleAnimation()]
})
export class PetsComponent extends AppComponentBase {
    @ViewChild('createOrEditTagModal', { static: true }) createOrEditTagModal: CreateOrEditTagModalComponent;
Here are some other code including ngOnInit etc. but I want to call the below function when a button is pressed:
createTag(): void {
        this.createOrEditTagModal.show();
    }
My problem is that I keep getting an error saying my this.createOrEditTagModal is undefined.
I have also imported this component in my main.module.ts and added it to my declarations there.
Can anyone help me as to why this keeps being undefined?
EDIT: For completeness, I added some code from create-or-edit-tag-modal-component
@Component({
    selector: 'createOrEditTagModal',
    templateUrl: './create-or-edit-tag-modal.component.html'
})
export class CreateOrEditTagModalComponent extends AppComponentBase {
    @ViewChild('createOrEditModal', { static: true }) modal: ModalDirective;
    @Output() modalSave: EventEmitter<any> = new EventEmitter<any>();
    constructor(
        injector: Injector,
        private _tagsServiceProxy: TagsServiceProxy
    ) {
        super(injector);
    }
    show():void{
        console.info("Called tag component successfully!"); //for testing
    }
 
     
    