PyDocs

Nav

Importing Modules

spec_from_file_location

importlib.util

function · Added in 3.4 (source)
  • spec_from_file_location(name, location, *, loader=None, submodule_search_locations=None)
Return a module spec based on a file location.

To indicate that the module is a package, set
submodule_search_locations to a list of directory paths.  An
empty list is sufficient, though its not otherwise useful to the
import system.

The loader must take a spec as its only __init__() arg.
Changed in 3.6
  • 3.6: Accepts a path-like object.
0 Examples
No examples for importlib.util/spec_from_file_location.
See Also
No see-alsos for importlib.util/spec_from_file_location
0 Notes
No notes for spec_from_file_location