Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
19030 มุมมอง

Hi

There is a custom_addons folder and there is no __init__.py file in it. There are two separate modules, lets say - module_one and module_two . In module_one there is a py file which I need in module_two to get a declared global variable.

Now when I write:

from odoo.addons.module_one import model

It shows error and doesn't find the module, because the module_one isn't in addons folder. I can't add __init__.py in the custom addons folder due to some restrictions. 

How can I get the custom modules py file in another custom module?

Thanks

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

It worked with: 

from odoo.addons.custom_addon_name.models.py_file_name import IMPORT_LIST

It looks like IDE was conning with me.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
__init__.py python import file แก้ไขแล้ว
7
ธ.ค. 23
27087
1
มี.ค. 15
10167
2
ต.ค. 23
4137
1
ม.ค. 23
6473
0
ก.ย. 17
5427