"BC30002: Type 'XXXXX is not defined" while using Invoke Code

While using Invoke Code one might get BC30002: Type 'XXXXX' is not defined. even after the variable is defined inside?

Approach 1:- 
Namespace should be imported in UiPath Studio. 
Steps shared as below:- 
a) Open the workflow in UiPath Studio, 
b) Go to the “Import” tab and then search for the namespace whose function is going to be used as part of the invoke code. 
c) Import the function.   

d) After following the above steps,  if there is still an error. 
Define the arguments explicitly as shown in the screenshot below.