Linked Questions

44 votes
3 answers
98k views

How can I access modules from another folder? Here's the file structure: /<appname> /config __init__.py config.py /test test.py # I'm here I wanted to access ...
Sean Francis N. Ballais's user avatar
6 votes
3 answers
14k views

I have a folder structure like this main_folder | |--done | | | |--test1 | |--__init__.py | |---check.py __init__.py: class Tries(object): def __init__(self): print "Test" check.py: ...
The6thSense's user avatar
  • 8,345
4 votes
3 answers
1k views

I'm trying to make a relative import in python. but I can't understand the syntax and everytime I search for it here in SO, I can't get an answer: Here is my folder structure: Root libraries ...
Evandro Silva's user avatar
0 votes
2 answers
4k views

I want to import modules from subfolers in Python. It works from main.py to the subfolder, but not from subfolder to subfolder. Every folder has a __init__.py This is how the folder structure looks ...
Marvin's user avatar
  • 33
0 votes
1 answer
443 views

I have folder structure as follows: /foo/trunk/mss/cloud and /foo/trunk/mss/model my python file is located at subfolder model with name test.py I want to import all modules located in subfolder ...
Amir's user avatar
  • 1,097
-1 votes
1 answer
188 views

I have some projects I try to split up for easier management. Therefor I moved some parts that are used by different applications into modules rather than copying files around. Right now I have the ...
Mirodin's user avatar
  • 35
-2 votes
2 answers
65 views

I have python code with the directory structure - main.py basics.py component1 file1.py file2.py component2 file1.py file2.py I want the code in the directories component1 and component2 ...
Surya Teja Chavali's user avatar
1868 votes
38 answers
1.6m views

How do I load a Python module given its full path? Note that the file can be anywhere in the filesystem where the user has access rights. See also: How to import a module given its name as string?
derfred's user avatar
  • 20.1k
857 votes
24 answers
683k views

I'm trying to follow PEP 328, with the following directory structure: pkg/ __init__.py components/ core.py __init__.py tests/ core_test.py __init__.py In core_test.py I have the ...
skytreader's user avatar
  • 11.8k
969 votes
20 answers
1.7m views

I have a directory that stores all the .py files. bin/ main.py user.py # where class User resides dir.py # where class Dir resides I want to use classes from user.py and dir.py in main.py. ...
Bin Chen's user avatar
  • 63.6k
630 votes
17 answers
441k views

Imagine this directory structure: app/ __init__.py sub1/ __init__.py mod1.py sub2/ __init__.py mod2.py I'm coding mod1, and I need to import something from mod2. How ...
Joril's user avatar
  • 20.8k
446 votes
21 answers
1.0m views

I'm building a simple helper script for work that will copy a couple of template files in our code base to the current directory. I don't, however, have the absolute path to the directory where the ...
baudtack's user avatar
  • 30.7k
205 votes
12 answers
90k views

It is recommended to not to use import * in Python. Can anyone please share the reason for that, so that I can avoid it doing next time?
Software Enthusiastic's user avatar
103 votes
5 answers
60k views

How can I import an arbitrary python source file (whose filename could contain any characters, and does not always ends with .py) in Python 3.3+? I used imp.load_module as follows: >>> ...
falsetru's user avatar
  • 371k
49 votes
7 answers
86k views

I'm having a problem with using Python on Spark. My application has some dependencies, such as numpy, pandas, astropy, etc. I cannot use virtualenv to create an environment with all dependencies, ...
Andrej Palicka's user avatar

15 30 50 per page
1
2 3 4 5
8