Linked Questions

0 votes
0 answers
260 views

I have a set of classes each with a constructor. These classes are in a folder (lets call this folder ABC). I have a separate python file (lets call this file PROJECT) that is in the parent folder of ...
Mathew Jacob's user avatar
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
7 votes
2 answers
5k views

I'm trying to write some (in my opinion) readable code in Python. I need a module that will contain a number of classes. Theoretically I know everything that is needed to accomplish this: I can simply ...
samuil's user avatar
  • 5,091
2 votes
1 answer
1k views

A project has the following structure: modulename ├── __init__.py │ ├── one │ ├── function_1.py │ ├── function2.py │ └─── __init__.py │ └── two ├── another_function.py ├── ...
loading...'s user avatar
1 vote
0 answers
828 views

Okay, so I'm trying to find a way to get a list of all modules in a package, into a variable. My file structure is as such: main/ app.py __init__.py modules/ __init.py mod_1.py ...
halolord01's user avatar
0 votes
0 answers
780 views

I am working as a summer intern at a fairly large company, me and another intern has been tasked with writing a background service from scratch in python(with given specifications). I can't say that I ...
xobust's user avatar
  • 1
1 vote
0 answers
329 views

If I have a class like this: class A(object): def __init__(self): self.dynamic_objects = [] And a subfolder in the same location with a variable amount of files each with one class that ...
Spencer Sutton's user avatar
2 votes
0 answers
191 views

I already took a look at this solution Importing classes from different files in a subdirectory , however it's still not working for me. I have my __init__.py file where I make the import: from api....
CodeTrooper's user avatar
  • 1,880
0 votes
1 answer
90 views

Can I import a class from a module, the same way as I can import the module like: from module_name import * so that I don't have to specify the "module.class" names every time I want a variable in it?...
Proud anti-zionist's user avatar
0 votes
0 answers
87 views

I'm new to Python so I'm sorry if this question seems dumb, but I couldn't find specific help on that. I'm working on a testing project where I wanted all the logic to be loaded into a mother ...
Anya's user avatar
  • 1,448
0 votes
1 answer
52 views

I'm writing a small package for internal use and come to a design problem. I define a few classes and constants (i.e., server IP address) in some file, let's call it mathfunc.py. Now, some of these ...
sashkello's user avatar
  • 18k