Pyperclip 1.8.2 conflicting with Pyautogui

Solution for Pyperclip 1.8.2 conflicting with Pyautogui
is Given Below:

  • Python Version: 3.9.6 (installed with brew)
  • MacOS: 11.5.1
  • Mac: early 2015, 13″ retina

I have code that I wrote that imports multiple modules, including pyperclip and pyautogui. When trying to run the example code from the pyperclip homepage in my pyperclip-script.py using python3 pyperclip-script.py , I got the following error:

Traceback (most recent call last):
     File "/Users/[my_user_name]/Documents/pyperclip-script.py", line 45, in <module>
pyperclip.copy('The text to be copied to the clipboard.')
     File "/usr/local/lib/python3.9/site-packages/pyperclip/__init__.py", line 659, in lazy_load_stub_copy return copy(text)
     File "/usr/local/lib/python3.9/site-packages/pyperclip/__init__.py", line 139, in copy_osx_pyobjc board.declareTypes_owner_([AppKit.NSStringPboardType], None)
     File "/usr/local/lib/python3.9/site-packages/objc/_lazyimport.py", line 207, in __getattr__ raise AttributeError(name)
AttributeError: NSStringPboardType

I started to debug by removing all modules except for pyperclip an then importing them one by one. When I import pyautogui, the Attribute Error is raised.

How can I fix this conflict? I can’t seem to find any documentation on this conflict.

ADDED: I found this documentation from Apple regarding the attribute error.