Hi sandraC,
The easiest workaround may be,
def import_from(path)->"Return the module exists in the given path.":
+ path = pathlib.Path(path)
mod_name = pathlib.Path(path).stem
spec = importlib.util.spec_from_file_location(mod_name, path)
You should also add,
+ spec.origin = path.parent.absolute()
to show repr(this_module)
nicely.
cf. see also a similar topic.