Hi,
Please See if Library file has been associated with the test correctly, you can confirm this by navigating to Resources >> Associated function libraries.
Code:
call sample
Call sample()
sample()
sample
All should work in your case.
Also let me know if you are using classes?
You can associate library file with test in following ways also:
[From QTP Help]
Associate an open function library with a test:[This is from QTP Help]
1. Make sure that the test with which you want to associate the function library is open in QuickTest.
2. Create or open a function library in QuickTest. (Before continuing to the next step, make sure that the function library you want to associate with the test is the active document—you can click the function library's tab to bring it into focus.)
3. Save the function library either in your Quality Center project or in the file system.
4 In QuickTest, select File > Associate Library '<Function Library>' with '<Test>', or right-click in the in the function library and select Associate Library '<Function Library>' with '<Test>'. QuickTest associates the function library with the open test.
OR
Associate a function library with a test using the Resources pane:
1. In the Resources pane, right-click the Associated Function Libraries node in the tree and select Associate Function Library. The Open Function Library dialog box opens.
2. In the sidebar, select the location of the file, for example, File System or Quality Center Test Resources. Browse to and select a function library, and click Open.
3. The function library is associated with the test and is displayed as a node under the Associated Function Libraries node in the tree.
Thanks,
Rajeshwar