

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to import a Python module given the full path?
The easiest way to import a Python module, given the full path is to add the path to the path variable. The path variable contains the directories Python interpreter looks in for finding modules that were imported in the source files.
For example
import sys sys.path.append('/foo/bar/my_module') # Considering your module contains a function called my_func, you could import it: from my_module import my_func # Or you could import the module as a whole, import my_module
- Related Questions & Answers
- Import a module in Python
- Import module in Python
- How to retrieve Python module path?
- How to import a single function from a Python module?
- How I can dynamically import Python module?
- OS Path module in Python
- How to import and export a module/library in JavaScript?
- How can import python module in IDE environment available in tutorialspoint?
- How to get full path of current file's directory in Python?
- How to print full path of current file's directory in Python?
- Accessing import parameters passed to a function module in SAP ABAP
- How to develop a Python Module?
- How to install a Python Module?
- How to write a python module?
- How to import other Python files?
Advertisements