That code should not import from otree.common_internal, since that is a module with internal (non-public) functionality.
There are 2 options:
(a) downgrade to the specific oTree version this was originally programmed on, e.g. otree==2.x.x
(b) remove that import statement and any use of get_models_module, which is the function that is being imported from that module. That function should really not be needed.