@fzahmed81, can you tell us what exactly do you want to do?
If you want to initialize an object of a device we already have in Python (the distance sensor, color sensor, etc and I presume it must be the distance sensor) you can then just instantiate the appropriate objects by reading the documentation (like check the above posts about it).
But if you want to support a different I2C device that we haven’t provided support for, then I highly recommend you to use our I2C implementation. It can be found here: https://github.com/DexterInd/RFR_Tools/blob/master/miscellaneous/di_i2c.py
Anyhow, I’m going to assume you’re strictly referring to the distance sensor, in which case, if you want to use it on the I2C bus, then you’d have to instantiate this way:
from di_sensors.easy_distance_sensor import EasyDistanceSensor
ds = EasyDistanceSensor()
# or
ds = EasyDistanceSensor(port = "I2C")
The 2nd way of instantiating the distance sensor object is pointless, but it shows you how you can change the bus for the distance sensor. In this case, it resorts, by default, to using the I2C bus.
Hope this makes sense to you.
Thank you!