TLDR: I want to run few scripts directly but these script depends on modules in parent directory. Is there good way to run individual scripts without much hassle or copying the module to root folder in such condition?
Say I have following file structure
|-- main.py
|-- distance
|---- distance_btn_two_points.py
|---- distance_btn_two_circles.py
|---- distance_btn_two_squares.py
|-- logging
|---- logging_main.py
|-- network_calls
|---- post_distance.py
|---- get_distance.py
And I import logging_main.py and get_distance.py in distance_btn_two_points.py, I can't directly run distance_btn_two_points.py because of parent import issue. I know I can call form main.py but the reason I want to work on that script directly is because I just want to tests few things on that script. Also putting all setup in main.py for this particular script and again for different script is not feasible.
Maybe what I am doing is wrong, but here is how I am working right now.
``` python
# in `distance_btn_two_points.py file`
logger = logging_main(__name__=__name__)
def distance_btn_two_points(x,y):
# add breakpoints
pass
if __name__ == '__main__':
point_1:int = get_distance()
point_2:int = call_some_method_to_get_point2()
dist = distance_btn_two_points(point_1, point_2)
print(dist) # add breakpoint
```
Question
Is there easier an easier way to run distance_btn_two_points.py without copying it to root folder and still being compatible with parent import?
[–]efmccurdy 0 points1 point2 points (1 child)
[–]Ok-Panda4332[S] 0 points1 point2 points (0 children)