magento2 – How to override a method in a vendor module?

Hi so i wrote this code to override a method in the woom cmstree module. But it seems like, something is wrong and i have used an entire day to figure it out, without any success.

My Vendor/MyModule/Block/Widget/Children.php


namespace VendorMyModuleBlockWidget;

class Children extends WoomCmsTreeBlockWidgetChildren


protected $belongsToMenu = "";

public function prepareLinks($treeChildren, $first = false)
    $html = '';

    some random code

    return $html;

My etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="WoomCmsTreeBlockWidgetChildren" type="VendorMyModuleBlockWidgetChildren" />

So this is how i did it. And i of course got the registration file and module.xml

But when i go to the page where this widget is used i get this error

(2021-03-04 20:56:22) main.CRITICAL: Error: Class 'VendorMymoduleBlockWidgetChildren' not found in /home/sonose2/public_html/generated/code/Vendor/Mymodule/Block/Widget/Children/Interceptor.php:7

I have been look at some examples but the are exact as mine and i have been trying alot of other stuff and now i ran out of ideas what to do.