Importing from Custom Folders/Directories

I’ve tried searching on the community help for this, but didn’t find a topic that addressed this, so perhaps someone can point me in the right direction.

I created a directory to help organize my code, for unit testing in repl.it. I would like to be able to import some of my code form that directory but when I use the

“from <directory_name> import ”

statement in the unit test set up I get a message that the module <directory_name> was not found. I’ve tried a number of permutations for the directory name including:

~ <directory_name>
/<directory_name>
<directory_name>
“<directory_name>”

but the results are the same. Does anyone know how to import from custom directories in repl.it? Any help would be appreciated.

Welcome to the forums.

You can only import from files, not directories.

2 Likes

Ah! Well that explains it. Thank you for the response. :slight_smile:

1 Like

You can mark @OmegaOrbitals 's response as a solution to close the topic.

Thank you. I marked it as a solution, but I’m not sure how to close it.

It closes automatically when a solution is marked.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.