A* Pathfinding Threading?

I’m trying to make A* use a separate thread to scan (using the component AstarPath). I have a scan script that tries to do this:

using UnityEngine;
using Pathfinding;
using System.Threading;
public class Scan : MonoBehaviour
{
    private AstarPath path;
    public bool isScanning;

    private void Awake()
    {
        path = GetComponent<AstarPath>();
        isScanning = false;
    }

    public void ScanFunc()
    {
        if (!isScanning)
        {
            isScanning = true;
            Thread thread = new Thread(ScanNow);
            thread.Start();
        }
    }
    void ScanNow()
    {
        path.Scan();
        isScanning=false;
    }
    
}

however, it gives me an error that states:

UnityException: get_isPlaying can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.

Is there any way to scan asynronisly from the other code? I tried finding answers but it seems impossible, and if I don’t, every time I try to scan the tiles it freezes the game for a second. My tiles are always changing due to explosions so I can’t just scan at the very beginning.

C# threading system doesn’t work well with unity’s systems, look into unity’s solution for multi-threading called the Job System