def copy_table(self):
print('aaa')
class T:
pass
T.copy_table = copy_table
b = T()
b.copy_table()
---------OUTPUT------------
'aaa'
import docx
docx.Document.copy_table = copy_table
doc = docx.Document('doc.docx')
doc.copy_table()
---------OUTPUT------------
AttributeError: 'Document' object has no attribute 'copy_table'
def Document(docx=None):
...