複数のPythonプラグインから呼ばれるユーザーライブラリを作成する
「C:\OSGeo4W\apps\Python37\lib」フォルダに「mylibs」フォルダを作成
mylibsフォルダには空の__init__.pyファイルと関数、クラスを定義したmyfunc.pyファイルを作成
__init__.py
# -*- coding: utf-8 -*- """ __init__.py """
myfunc.py
# -*- coding: utf-8 -*- def myproc(): print('Hello') class MyClass: def __init__(self): self.name = 'Hello' def print_name(self): print(self.name)
QGISのPythonコンソールからの呼び出し
from test import myfunc mc = MyClass() from test.myfunc import MyClass c = MyClass() c.print_name()