Does Uipath Invoke code activity requires Imports namespaces be declared in the code box?

Usually in VScode we would start writing code by declaring Libraries and namespaces so does UiPath Invoke code activity requires “Imports namespaces” in the code box?

1 Like


Yes, if you are using UiPath Invoke Code activity to execute custom code within your workflow, you must declare any necessary Imports namespaces in the code box.

Yes, the Invoke Code activity in UiPath requires that you import any required namespaces in the code box. This is because the code that you write in the code box is compiled at runtime and executed within the context of the workflow.

It is important to note that the namespaces you import should correspond to the libraries that you have referenced in your project. If you try to import a namespace that is not referenced, you will get a compilation error when you run the workflow.

Cheers @Mohite_Bhushan

Hi @Mohite_Bhushan ,

Addition to the above, If there are ambiguous Properties or Methods present in two or more namespaces, then you would require to use the full namespace when using those methods in the Invoke Code activity.

Thank you everyone

1 Like


In the code box you need not import…

You would import the namespaces in the imports panel at the bottom of your studio

Any package needed can be added through manage packages

And yes if two namespaces have same method then follow as suggested by @supermanPunch

Hope this helps


1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.