Narae
Narae

Reputation: 69

how to solve the .py file in same directory?

I am working on a project using python.

I am trying to import the .py file that is in the same parent folder. This is my simplified project tree


My_project
+--run.py
|
+--trn_db.py

in run.py I did import trn_db as td but it has an unresolved import warning.

How do I resolve this?

Thank you.

Upvotes: 0

Views: 58

Answers (1)

yigal
yigal

Reputation: 4745

  from . import trn_db as td

-should work for python3

Upvotes: 1

Related Questions