# How to use python file in Robot Framework?

**URL:** <https://forum.robotframework.org/t/how-to-use-python-file-in-robot-framework/2544>\
**Category:** Robot Framework\
**Created:** [8 October 2021 16:42 UTC](https://forum.robotframework.org/t/how-to-use-python-file-in-robot-framework/2544 "2021-10-08T16:42:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prakash](https://avatars.discourse-cdn.com/v4/letter/p/3be4f8/32.png) [@Prakash](https://forum.robotframework.org/u/Prakash)\
**Post date:** [8 October 2021 16:42 UTC](https://forum.robotframework.org/t/how-to-use-python-file-in-robot-framework/2544/1 "2021-10-08T16:42:37Z")

</div>

May I know, how can I use python file in Robot Framework.

---

<div class="post-metadata">

**Author:** ![aaltat](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/aaltat/32/15_2.png) [@aaltat](https://forum.robotframework.org/u/aaltat)\
**Post date:** [8 October 2021 19:03 UTC](https://forum.robotframework.org/t/how-to-use-python-file-in-robot-framework/2544/2 "2021-10-08T19:03:12Z")

</div>

It depends how that Python file is meant to be used, but many times using it as library is easiest way. Here is link to user guide [Robot Framework User Guide](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#creating-test-libraries)

---

<div class="post-metadata">

**Author:** ![Prakash](https://avatars.discourse-cdn.com/v4/letter/p/3be4f8/32.png) [@Prakash](https://forum.robotframework.org/u/Prakash)\
**Post date:** [9 October 2021 01:35 UTC](https://forum.robotframework.org/t/how-to-use-python-file-in-robot-framework/2544/3 "2021-10-09T01:35:00Z")

</div>

Any reference code if you have then let me know?

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [9 October 2021 04:39 UTC](https://forum.robotframework.org/t/how-to-use-python-file-in-robot-framework/2544/4 "2021-10-09T04:39:18Z")

</div>

Hi Prakash,

There are java and python examples in the documentation: [creating test library class or module](http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#creating-test-library-class-or-module)

Just create the python example as is, run it and see what it does then modify it, it’s pretty easy.

In case it’s not clear, make sure your filename (the part before the .py) is the same as the class name (including upper/lower case)

Dave.
