File mover based on document name
A few changes I would make:

Follow PEP 8.
Use the modern, high-level pathlib instead of a combination of the os module, glob, and shutil.
Be careful when using a bare except:, or except Exception:, see https://stackoverflow.com/q/54948548.

import pathlib

docs_dir = pathlib.Path('')
target_dir = pathlib.Path('')

for file in docs_dir.glob('*-*'):  # Each file gets moved one by one
    subject_name, file_name = str(file.name).split('-', maxsplit=1)
    subject_dir = target_dir.joinpath(subject_name)
    
    subject_dir.mkdir(exist_ok=True)
    file.rename(subject_dir.joinpath(file_name))

As an aside, it may be worth considering using a folder just for unsorted school-related files. It would be so easy to add a non-schoolwork file which contains a '-' to your documents folder, and have it moved unintentionally by the program.
You wrote in a comment:

However I aim for that &quot;I saved the file and it directly moved to the targeted folder&quot; approach.

If that's the case, you should look into file system watchers/watchdogs.