调用未定义的函数convert_to_screen()(Wordpress)

i am developing a plugin where i did have to extend the class WP_List_Table. I have extended the class within my plugin-file (I don't know if this is the right way to do this?) and included WP_List_Table like this:

if(!class_exists('WP_List_Table')){
   require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}

Then comes the code for extending the class and then i do create an instance of my table class like this:

$wp_analyzes_table = new RAnalyzes_List_Table();
$wp_analyzes_table->prepare_items(); 

But when i do this, i do get this error:

Fatal error: Call to undefined function convert_to_screen() in C:\xampp\htdocs orskeanalyser\wp-admin\includes\class-wp-list-table.php on line 143

I did some research but did not understand how to fix it.

Does anybody knows how to fix this?

Thanks for your help!

Best regards.

Add

require_once(ABSPATH . 'wp-admin/includes/screen.php');

to your theme/function.php. This will solve it.