How to start a timer after object is not active?

My code is not working. The timer only works when I removed the if statement on the start function there.

void Start()
{
    if (uiPanel.activeInHierarchy == false)
    {
        StartCoroutine(Countdown());
    }
}

IEnumerator Countdown()
{
    while (countdownTime > 0)
        {
            countdownText.text = countdownTime.ToString();

            yield return new WaitForSeconds(1f);
            countdownTime--;
        }

        countdownText.gameObject.SetActive(false);       
}

If the timer is attached to the GameObject that is being disabled, the code is also being disabled, so the timer wont work as it is disabled. You have to have to have the timer be on a separate GameObject that isn’t being disabled!