can I call invoke from an object that will be destroyed before the invoke completes?

I want to invoke a function call after the object is destroyed. Basically I want to do something like:

Invoke(“myfunc”, 5);
Destroy(gameObject);

This doesn’t work. Is there a way to accomplish this without moving the invoke off the object?

You can delay the destroy and disable the game object:

#pragma strict
 
    function Start () {
    	Invoke("myfunc", 5);
    	gameObject.SetActive(false);
    	Destroy(gameObject,5.1);
    }  
    
    function myfunc() {
      Debug.Log("myFunc invoked");
    }