Reimport library while running testcase

Hi team ,
I written 1 python library and need to pass 4 aruguments i.e username, password , broker IP, broker Port
Initially i importe library in settings section but while running testcase i need to manipulate the broker port .
I need reipmport library with new port is it possible if yes how can i do?

https://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Import%20Library

1 Like

Used this way but it still loading existing library only

Do you need 2 instances of the library or can you reuse the existing one by calling a method?

In order to use the prementioned solution, you have to import the library twice with the addition “as”.

Import    Mylibrary.py    as Library1 
Import    Mylibrary.py    as Library2

Just add a keyword in the library, something like update_broker_port that accepts the new value and have that update the self.broker_port set in the init.

1 Like