You do recognize, that your answer is not actually an answer, didnt you?
I do not use pycharm, I run python prompt from linux terminal. And that statement “that doesn’t work because it’s wrong” makes me fill suspicious about your competence.
Let’s take a simple example with some dumb python module with only one function:
bkaba@bkaba:~$ cat some_python_module/some_python_module.py
def foo():
print('Oh no, it works')
Now let’s run it with the same python import rules:
bkaba@bkaba:~$ python3
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from some_python_module import some_python_module
>>> some_python_module.foo()
Oh no, it works
Now, please, tell me, why it supposed to fail and why it worked with opencv 4.5.5?
But my original question was “how I supposed to import custom built opencv lib in python module?”
# __init__.py
import importlib
from .cv2 import *
# wildcard import above does not import "private" variables like __version__
# this makes them available
globals().update(importlib.import_module('cv2.cv2').__dict__)