Q:

calling public function from another php

I'm working on WordPress plugin where I have 2 php files.
class.php has code as: 
class Plugin_Name {

     public function say_hello() {
         echo "Hello";
     }

}

Now I want to call this say_hello() function from another welcome.php file.
I tried 
$hello_function = new Plugin_Name();
$hello_function->say_hello();

But it doesn't work. Is there any way to call public function from another php ?

A:

You need to include the first function in the other file, that way the other file knows the code is there. At the top of welcome.php add 
require_once('/path/to/class.php');
$hello_function = new Plugin_Name();
$hello_function->say_hello();

