## worldpay class not working with namespace in WordPress

Question

I am trying to create Worldpay gateway with help of Worldpay library and my own extending code. Here is my code which I tried and failed to work on.

require_once('init.php');

use libWorldpay;

if($_POST ==$_SERVER['REQUEST_METHOD']) {
//Form Submit Actions, Here i have called Worldpay class to create object.
\$worldpay = new Worldpay('Key');   //line no:  25
}  ?>
<script src="https://cdn.worldpay.com/v1/worldpay.js"></script>
<form  action="" method="post">

</form>


I have tried to find similar question and answer. I found this. Eventhough i can’t make it work, when form is submitted to the same page. Here is the error message how it looks like.