i have 2 treewidgets placed in a frame in mainwindow. how can i have 2 different set of context menu options for the 2 treewidgets? i need individual set of right click options for the treewidgets.Thanks in advance..
Every QWidget has a contextMenuPolicy property which defines what to do when context menu is requested. A simpliest way to do what you need is like this:

Create QAction objects that call methods you want.
Add these actions to your tree widgets using widget.addAction()
Call widget.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)

That's it. Context menu for the widget will contain actions you added.
PyQT treewidgets with different context menu options