Calling a class method instantiated by ajax call in wordpress [closed]

You class method need to be static to be access without initializing the class or public in order to access from the class itself without reference &. And the variable $this->itemsClass also need to be public. So the workaround is –

class Plugin
{
    public $itemsClass;

    function __construct()
    {

        add_action('wp_ajax_list_items', array(
            $this,
            'list_items'
        ));
    }

    public function list_items()
    {
        // Get class instance
        self::$itemsClass = new itemsClass();

        echo "success";
        die();
    }

    public function another_function()
    {
        // Can't access this function
        self::$itemsClass->list_items();

        return false;
    }
}