opposite_ai.py
import math
# 反対向けのAI
class Oppai:
#処理
pass
hent_ai.py
#つかむ動作のAI
class Hentai:
#処理
pass
app.json.py
import hent_ai
from hent_ai import Hentai #Hentai()でインスタンス作成できる
import opposite_ai as oppai #oppaiでopposite_aiが使える。
import opposite_ai.math #oppai.mathと書かなくてよくなる。
try:
setai=__import__("set_ai")#詳細設定。有無が
except Exception as e:
print(e)
class classproperty(property):
pass
class PropertyMeta(type):
def __new__(cls, name, bases, namespace):
props = [(k, v) for k, v in namespace.items() if type(v) == classproperty]
for k, v in props:
setattr(cls, k, v)
del namespace[k]
return type.__new__(cls, name, bases, namespace)
class StartUp(metaclass=PropertyMeta):
__this = None
def __init__(self):
self.hentai = Hentai()
self.oppai = oppai.Oppai()
pass
@classproperty
def value(cls):
if cls.__this is not None:
return cls.__this
cls.__this = StartUp()
return cls.__this
@classmethod
def main(cls):
cls.value
print("Hello World")
cls.__this.input = input("何か入力")
return
if __name__ == "__main__":
StartUp.main()