0

I'm working on pycharm. I have create a custom script with a bunch of auxiliary functions I want to import in my script.

I'm trying to:

import support_functions

But its not recognized. My script and support_functions are in different directories. There is any way to import a script?

1 Answer 1

2

Modules are loaded from the Python path, which is a list of directories to search when using import. You can always add a folder to the Python path by using sys.path.append:

import sys
sys.path.append("/path/to/package_containing_support_functions")

You can also set the PYTHONPATH environment variable in your operating system to control what modules paths Python loads before it runs your program.

In PyCharm you can set this in the Environment variables field in the Run/Debug window:

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.