How to load an entire entire dicom directory using the widget button on a python code?

You can use DICOMLib.DICOMUtils.LoadDICOMFilesToDatabase See complete example here:

See also this post: Imported dicom files do not show in the dicomDatabase